mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-17 03:36:37 +00:00

When a structure constructor does not initialize an allocatable component, ensure that the typed expression representation contains an explicit NULL() for the component. Expression semantics already copies default initialized expressions for nonallocatable components into structure constructors. This change is expected to simplify lowering. Differential Revision: https://reviews.llvm.org/D121162
25 lines
534 B
Fortran
25 lines
534 B
Fortran
! RUN: %python %S/test_modfile.py %s %flang_fc1
|
|
! Ensures that uninitialized allocatable components in a structure constructor
|
|
! appear with explicit NULL() in the expression representation.
|
|
module m
|
|
type t
|
|
real, allocatable :: x1, x2, x3
|
|
end type
|
|
type t2
|
|
type(t) :: a = t(NULL(),x2=NULL())
|
|
end type
|
|
end module
|
|
|
|
!Expect: m.mod
|
|
!module m
|
|
!type::t
|
|
!real(4),allocatable::x1
|
|
!real(4),allocatable::x2
|
|
!real(4),allocatable::x3
|
|
!end type
|
|
!type::t2
|
|
!type(t)::a=t(x1=NULL(),x2=NULL(),x3=NULL())
|
|
!end type
|
|
!intrinsic::null
|
|
!end
|