2017-02-20 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / pointer_intent_4.f90
blob862edff4a58a5c52ec79273b6ccd44f44a1e25c6
1 ! { dg-do run }
2 ! { dg-options "-fno-inline" }
4 ! PR fortran/46937
6 ! Check that a non-pointer INTENT(IN) dummy
7 ! with pointer component is properly treated
9 program test
10 type myT
11 integer, pointer :: point
12 end type myT
13 type(myT) :: t2
14 allocate(t2%point)
15 t2%point = 42
16 call nonpointer(t2)
17 if(t2%point /= 7) call abort()
18 t2%point = 42
19 call nonpointer2(t2)
20 if(t2%point /= 66) call abort()
21 contains
22 subroutine nonpointer(t)
23 type(myT), intent(in) :: t
24 t%point = 7
25 end subroutine nonpointer
26 subroutine nonpointer2(t)
27 class(myT), intent(in) :: t
28 t%point = 66
29 end subroutine nonpointer2
30 end program