OSDN Git Service

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