summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/char_pointer_assign_5.f90
blob: 471f6e6b1620c2e150850f3bb47a48ffeff7c70c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
! { 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
  call bar((/ s1, s1 /))
contains
  subroutine bar(s)
    character(len=*),target  :: s(2)
    character(len=17),pointer :: p(:)
    p => s
  end subroutine bar
end program ptr

! { dg-output "Unequal character lengths \\(17/10\\)" }