| 1 |
! { dg-do run } |
| 2 |
! { dg-additional-options "-fcheck=all" } |
| 3 |
! { dg-shouldfail "Substring out of bounds" } |
| 4 |
! |
| 5 |
! PR fortran/85781 |
| 6 |
! |
| 7 |
! Co-contributed by G. Steinmetz |
| 8 |
|
| 9 |
use iso_c_binding, only: c_char |
| 10 |
call s(c_char_'x', -2, -2) |
| 11 |
contains |
| 12 |
subroutine s(x,m,n) bind(c) |
| 13 |
use iso_c_binding, only: c_char |
| 14 |
character(kind=c_char), value :: x |
| 15 |
call foo(x(m:), m, n) |
| 16 |
end |
| 17 |
subroutine foo(str, m, n) |
| 18 |
character(len=*) :: str |
| 19 |
end |
| 20 |
end |
| 21 |
! { dg-output "Fortran runtime error: Substring out of bounds: lower bound .-2. of 'x' is less than one" } |