2017-02-20 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / associated_1.f90
blobe214fe2729eab6448686f58cb5b9a0572a20ccad
1 ! { dg-do run }
2 ! PR 25292: Check that the intrinsic associated works with functions returning
3 ! pointers as arguments
4 program test
5 real, pointer :: a, b
7 nullify(a,b)
8 if(associated(a,b).or.associated(a,a)) call abort()
9 allocate(a)
10 if(associated(b,a)) call abort()
11 if (.not.associated(x(a))) call abort ()
12 if (.not.associated(a, x(a))) call abort ()
14 nullify(b)
15 if (associated(x(b))) call abort ()
16 allocate(b)
17 if (associated(x(b), x(a))) call abort ()
19 contains
21 function x(a) RESULT(b)
22 real, pointer :: a,b
23 b => a
24 end function x
26 end program test