gcc/testsuite/gfortran.dg/substr_2.f
raw| 1 | ! { dg-do run } |
| 2 | ! Check that substrings behave correctly even when zero-sized |
| 3 | implicit none |
| 4 | character(len=10) :: s, t |
| 5 | integer :: i, j |
| 6 | |
| 7 | s = "abcdefghij" |
| 8 | t(:10) = s(1:) |
| 9 | s(6:5) = "foo" |
| 10 | if (s /= t) STOP 1 |
| 11 | i = 2 |
| 12 | j = -1 |
| 13 | s(i:i+j) = "foo" |
| 14 | if (s /= t) STOP 2 |
| 15 | i = 20 |
| 16 | s(i+1:i) = "foo" |
| 17 | if (s /= t) STOP 3 |
| 18 | s(6:5) = s(7:5) |
| 19 | if (s /= t) STOP 4 |
| 20 | s = t(7:6) |
| 21 | if (len(trim(s)) /= 0) STOP 5 |
| 22 | if (len(t(8:4)) /= 0) STOP 6 |
| 23 | if (len(trim(t(8:4))) /= 0) STOP 7 |
| 24 | end |