OSDN Git Service

2011-09-26 Janus Weil <janus@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / pointer_intent_4.f90
1 ! { dg-do run }
2 ! { dg-options "-fno-inline" }
3 !
4 ! PR fortran/46937
5 !
6 ! Check that a non-pointer INTENT(IN) dummy
7 ! with pointer component is properly treated
8 !
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