Debian Codegraph @

gcc/testsuite/gfortran.dg/pdt_31.f03

raw
1 ! { dg-do run }
2 !
3 ! Test the fix for PR100110, in which 'obj' was not being initialized.
4 !
5 ! Contributed by Xiao Liu <[email protected]>
6 !
7 program p
8 implicit none
9 type t(n)
10 integer, len :: n
11 integer :: arr(n, n)
12 end type
13
14 type(t(2)) :: obj
15
16 obj%arr = reshape ([1,2,3,4],[2,2])
17 if (obj%n .ne. 2) stop 1
18 if (any (shape(obj%arr) .ne. [2,2])) stop 2
19 call test()
20 contains
21 subroutine test()
22 if (obj%n .ne. 2) stop 3
23 if (any (shape(obj%arr) .ne. [2,2])) stop 4
24 if (any (reshape (obj%arr, [4]) .ne. [1,2,3,4])) stop 5
25 end subroutine
26 end program