OSDN Git Service

2007-07-09 Thomas Koenig <tkoenig@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / char_pointer_dummy.f90
1 ! { dg-do run }
2 program char_pointer_dummy\r
3 ! Test character pointer dummy arguments, required\r
4 ! to fix PR16939 and PR18689\r
5 ! Provided by Paul Thomas pault@gcc.gnu.org\r
6   implicit none\r
7   character*4                :: c0\r
8   character*4, pointer       :: c1\r
9   character*4, pointer       :: c2(:)\r
10   allocate (c1, c2(1))\r
11 ! Check that we have not broken non-pointer characters.\r
12   c0 = "wxyz"\r
13   call foo (c0)\r
14 ! Now the pointers\r
15   c1 = "wxyz"\r
16   call sfoo (c1)\r
17   c2 = "wxyz"\r
18   call afoo (c2)\r
19   deallocate (c1, c2)\r
20 contains\r
21   subroutine foo (cc1)\r
22     character*4                :: cc1\r
23     if (cc1 /= "wxyz") call abort ()\r
24   end subroutine foo\r
25   subroutine sfoo (sc1)\r
26     character*4, pointer       :: sc1\r
27     if (sc1 /= "wxyz") call abort ()\r
28   end subroutine sfoo\r
29   subroutine afoo (ac1)\r
30     character*4, pointer       :: ac1(:)\r
31     if (ac1(1) /= "wxyz") call abort ()\r
32   end subroutine afoo\r
33 end program char_pointer_dummy