2009-10-05 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / char_pointer_assign_5.f90
blob471f6e6b1620c2e150850f3bb47a48ffeff7c70c
1 ! { dg-do run }
2 ! { dg-options "-fbounds-check" }
3 ! { dg-shouldfail "Unequal character length" }
5 ! PR fortran/31822
6 ! Verify that runtime checks for matching character length
7 ! in pointer assignment work.
9 ! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
11 program ptr
12 implicit none
13 character(len=10), target :: s1
14 call bar((/ s1, s1 /))
15 contains
16 subroutine bar(s)
17 character(len=*),target :: s(2)
18 character(len=17),pointer :: p(:)
19 p => s
20 end subroutine bar
21 end program ptr
23 ! { dg-output "Unequal character lengths \\(17/10\\)" }