PR tree-optimization/86415 - strlen() not folded for substrings within constant arrays
[official-gcc.git] / gcc / testsuite / gfortran.dg / substr_6.f90
blob0d5e3d75e88c000d65a28ba3fae377df251180d5
1 ! { dg-do run }
2 ! { dg-options "-std=legacy" }
4 ! Check that NULs don't mess up constant substring simplification
5 CHARACTER(5), parameter :: c0(1) = (/ "123" // ACHAR(0) // "5" /)
6 CHARACTER*5 c(1)
7 CHARACTER(1), parameter :: c1(5) = (/ "1", "2", "3", ACHAR(0), "5" /)
9 c = (/ c0(1)(1:5) /)
10 do i=1,5
11 if (c(1)(i:i) /= c1(i)) STOP 2
13 ! Make NULs visible (and avoid corrupting text output).
14 if (c(1)(i:i) == ACHAR(0)) then
15 print "(a,$)", "<NUL>"
16 else
17 print "(a,$)", c(1)(i:i)
18 end if
19 end do
21 print *, ""
23 end