RISC-V: Regenerate opt urls.
[official-gcc.git] / gcc / testsuite / gfortran.dg / result_default_init_1.f90
blob8803833f83e5d76224ad2d2b6c1672e9acb95d40
1 ! { dg-do run }
2 ! { dg-options "-O" }
3 ! Test the fix for PR29216 in which function results did not
4 ! get default initialization.
5 ! Contributed by Stephan Kramer <stephan.kramer@imperial.ac.uk>
7 type A
8 integer, pointer:: p => null ()
9 integer:: i=3
10 end type A
11 type(A):: x,y
12 if (associated(x%p) .or. x%i /= 3) STOP 1
13 x=f()
14 if (associated(x%p) .or. x%i /= 3) STOP 2
15 x=g()
16 if (associated(x%p) .or. x%i /= 3) STOP 3
17 contains
18 function f() result (fr)
19 type(A):: fr
20 if (associated(fr%p) .or. fr%i /= 3) STOP 4
21 end function f
22 function g()
23 type(A):: g
24 if (associated(g%p) .or. g%i /= 3) STOP 5
25 end function g
26 end