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