summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/char_pointer_assign_4.f90
blob: 7dfc39b946c870ede7221ce3d6aae8879589d5c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
! { dg-do run }
! { dg-options "-fbounds-check" }
! { dg-shouldfail "Unequal character length" }

! PR fortran/31822
! Verify that runtime checks for matching character length
! in pointer assignment work.

! Contributed by Tobias Burnus <burnus@gcc.gnu.org>

program ptr
  implicit none
  character(len=10), target :: s1
  character(len=5), pointer :: p1
  integer, volatile :: i
  i = 8
  p1 => s1(1:i) 
end program ptr

! { dg-output "Unequal character lengths \\(5/8\\)" }