blob: b995a7d1a4ae3c69383a34b8b9db4165a783ff7b [file] [edit]
! Verify that the module file of a module that omits, in a structure
! constructor, a component whose type has default initialization holds a
! constructor that can be read back with the same values.
! RUN: rm -rf %t && split-file %s %t
! RUN: %flang_fc1 -fsyntax-only -J%t %t/def.f90
! RUN: FileCheck --input-file=%t/mf95.mod %s
! RUN: %flang_fc1 -fdebug-dump-symbols -J%t %t/use.f90 | FileCheck --check-prefix=USE %s
! CHECK: type(outer),parameter::c=outer(comp=inner(x=1_4),comps=[inner::inner(x=1_4),inner(x=1_4)])
! CHECK: type(outer)::h=outer(comp=inner(x=1_4),comps=[inner::inner(x=1_4),inner(x=1_4)])
! USE: x1, PARAMETER {{.*}} init:1_4
! USE: x2, PARAMETER {{.*}} init:2_4
!--- def.f90
module mf95
type inner
integer :: x = 1
end type
type outer
type(inner) :: comp
type(inner) :: comps(2)
end type
type(outer), parameter :: c = outer()
type holder
type(outer) :: h = outer()
end type
end module
!--- use.f90
subroutine s
use mf95
integer, parameter :: x1 = c%comp%x
integer, parameter :: x2 = sum(c%comps%x)
type(holder) :: v
end subroutine