[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / flang / test / Semantics / modfile27.f90
bloba5365d17723f0783006d9c57514f6b56fbf6d59e
1 ! RUN: %python %S/test_modfile.py %s %flang_fc1
2 ! Test folding of combined array references and structure component
3 ! references.
5 module m1
6 type :: t1
7 integer :: ia1(2)
8 end type t1
9 type(t1), parameter :: t1x1(*) = [t1::t1(ia1=[1,2]),t1(ia1=[3,4])]
10 logical, parameter :: t1check1 = t1x1(2)%ia1(1) == 3
11 logical, parameter :: t1check2 = all(t1x1(1)%ia1 == [1,2])
12 logical, parameter :: t1check3 = all(t1x1(:)%ia1(1) == [1,3])
13 type :: t2
14 type(t1) :: dta1(2)
15 end type t2
16 type(t2), parameter :: t2x1(*) = &
17 [t2 :: t2(dta1=[t1::t1x1]), &
18 t2(dta1=[t1::t1(ia1=[5,6]),t1(ia1=[7,8])])]
19 logical, parameter :: t2check1 = t2x1(1)%dta1(2)%ia1(2) == 4
20 logical, parameter :: t2check2 = &
21 all(t2x1(2)%dta1(2)%ia1(:) == [7,8])
22 logical, parameter :: t2check3 = &
23 all(t2x1(1)%dta1(:)%ia1(2) == [2,4])
24 logical, parameter :: t2check4 = &
25 all(t2x1(:)%dta1(1)%ia1(2) == [2,6])
26 end module m1
27 !Expect: m1.mod
28 !module m1
29 !type::t1
30 !integer(4)::ia1(1_8:2_8)
31 !end type
32 !type(t1),parameter::t1x1(1_8:*)=[t1::t1(ia1=[INTEGER(4)::1_4,2_4]),t1(ia1=[INTEGER(4)::3_4,4_4])]
33 !logical(4),parameter::t1check1=.true._4
34 !logical(4),parameter::t1check2=.true._4
35 !intrinsic::all
36 !logical(4),parameter::t1check3=.true._4
37 !type::t2
38 !type(t1)::dta1(1_8:2_8)
39 !end type
40 !type(t2),parameter::t2x1(1_8:*)=[t2::t2(dta1=[t1::t1(ia1=[INTEGER(4)::1_4,2_4]),t1(ia1=[INTEGER(4)::3_4,4_4])]),t2(dta1=[t1::t1(ia1=[INTEGER(4)::5_4,6_4]),t1(ia1=[INTEGER(4)::7_4,8_4])])]
41 !logical(4),parameter::t2check1=.true._4
42 !logical(4),parameter::t2check2=.true._4
43 !logical(4),parameter::t2check3=.true._4
44 !logical(4),parameter::t2check4=.true._4
45 !end