Skip to content

Commit 2d23a60

Browse files
authored
[flang][cuda] Add TODO for allocate with default initialization (#163625)
1 parent 4a44f03 commit 2d23a60

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

flang/lib/Lower/Allocatable.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,15 @@ class AllocateStmtHelper {
767767
const fir::MutableBoxValue &box,
768768
ErrorManager &errorManager,
769769
const Fortran::semantics::Symbol &sym) {
770+
771+
if (const Fortran::semantics::DeclTypeSpec *declTypeSpec = sym.GetType())
772+
if (const Fortran::semantics::DerivedTypeSpec *derivedTypeSpec =
773+
declTypeSpec->AsDerived())
774+
if (derivedTypeSpec->HasDefaultInitialization(
775+
/*ignoreAllocatable=*/true, /*ignorePointer=*/true))
776+
TODO(loc,
777+
"CUDA Fortran: allocate on device with default initialization");
778+
770779
Fortran::lower::StatementContext stmtCtx;
771780
cuf::DataAttributeAttr cudaAttr =
772781
Fortran::lower::translateSymbolCUFDataAttribute(builder.getContext(),
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
! RUN: %not_todo_cmd bbc -emit-fir -fcuda -o - %s 2>&1 | FileCheck %s
2+
3+
program test
4+
implicit none
5+
6+
type :: t1
7+
real(4) :: x_fin(1:10) = acos(-1.0_4)
8+
end type t1
9+
10+
type(t1), allocatable, device :: t(:)
11+
12+
! CHECK: not yet implemented: CUDA Fortran: allocate on device with default initialization
13+
allocate(t(1:2))
14+
15+
end program

0 commit comments

Comments
 (0)