Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions flang/lib/Lower/Allocatable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,15 @@ class AllocateStmtHelper {
const fir::MutableBoxValue &box,
ErrorManager &errorManager,
const Fortran::semantics::Symbol &sym) {

if (const Fortran::semantics::DeclTypeSpec *declTypeSpec = sym.GetType())
if (const Fortran::semantics::DerivedTypeSpec *derivedTypeSpec =
declTypeSpec->AsDerived())
if (derivedTypeSpec->HasDefaultInitialization(
/*ignoreAllocatable=*/true, /*ignorePointer=*/true))
TODO(loc,
"CUDA Fortran: allocate on device with default initialization");

Fortran::lower::StatementContext stmtCtx;
cuf::DataAttributeAttr cudaAttr =
Fortran::lower::translateSymbolCUFDataAttribute(builder.getContext(),
Expand Down
15 changes: 15 additions & 0 deletions flang/test/Lower/CUDA/TODO/cuda-allocate-default-init.cuf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
! RUN: %not_todo_cmd bbc -emit-fir -fcuda -o - %s 2>&1 | FileCheck %s

program test
implicit none

type :: t1
real(4) :: x_fin(1:10) = acos(-1.0_4)
end type t1

type(t1), allocatable, device :: t(:)

! CHECK: not yet implemented: CUDA Fortran: allocate on device with default initialization
allocate(t(1:2))

end program