| ! { dg-options "-fcheck=bounds -fdump-tree-original" } |
| character(10) :: str = "1234567890" |
| print *, str(-1:-2) ! zero-length substring: OK |
| print *, str(-1:n) ! 2 checked bounds |
| print *, len (str(-1:n)) ! 2 checked bounds |
| print *, str(-n:1) ! 1 checked bound / 1 eliminated |
| print *, len (str(-n:1)) ! 1 checked bound / 1 eliminated |
| print *, str(-n:11) ! 2 checked bounds |
| print *, len (str(-n:11)) ! 2 checked bounds |
| print *, str(-n*n%kind:sum(n-[0,n%kind])) ! 2 checked bounds |
| ! { dg-final { scan-tree-dump-times "Substring out of bounds:" 12 "original" } } |