| 1 |
! { dg-do run } |
| 2 |
! { dg-options "-fcheck=bounds" } |
| 3 |
program rabbithole |
| 4 |
implicit none |
| 5 |
character(len=:), allocatable :: text_block(:) |
| 6 |
integer i, ii |
| 7 |
character(len=10) :: cten='abcdefghij' |
| 8 |
character(len=20) :: ctwenty='abcdefghijabcdefghij' |
| 9 |
ii = -6 |
| 10 |
text_block=[ character(len=ii) :: cten, ctwenty ] |
| 11 |
if (any(len_trim(text_block) /= 0)) STOP 1 |
| 12 |
end program rabbithole |
| 13 |
! { dg-output "At line 10 of file .*char_length_20.f90.*Fortran runtime warning: Negative character length treated as LEN = 0" } |