Debian Codegraph @

gcc/testsuite/gfortran.dg/coarray/sizeof_1.f90

raw
1 !{ dg-do run }
2
3 ! Check that pr77518 is fixed.
4 ! Based on code by Gerhard Steinmetz <[email protected]>
5
6 program coarray_sizeof_1
7 type t
8 end type
9 type t2
10 integer :: v = 42
11 end type
12 type t3
13 type(t2) :: s
14 integer :: n = 1
15 end type
16
17 class(t), allocatable :: z[:]
18 class(t2), allocatable :: z2[:]
19 class(t3), allocatable :: z3[:]
20
21 if (sizeof(z) /= 0) stop 1
22 if (sizeof(z2) /= sizeof(integer)) stop 2
23 allocate(z3[*])
24 if (sizeof(z3) /= sizeof(z2) + sizeof(integer)) stop 3
25 if (sizeof(z3%s) /= sizeof(z2)) stop 4
26 end
27