summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/bind_c_char_5.f90
blob: 9092dd58396a1e8c5abb8d5a80037612d5b1e7a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
! { dg-do run }
! { dg-additional-options "-fcheck=all" }
! { dg-shouldfail "Substring out of bounds" }
!
! PR fortran/85781
!
! Co-contributed by G. Steinmetz 

  use iso_c_binding, only: c_char
  call s(c_char_'x', -2, -2)
contains
  subroutine s(x,m,n) bind(c)
    use iso_c_binding, only: c_char
    character(kind=c_char), value :: x
    call foo(x(m:), m, n)
  end
  subroutine foo(str, m, n)
    character(len=*) :: str
  end
end
! { dg-output "Fortran runtime error: Substring out of bounds: lower bound .-2. of 'x' is less than one" }