comparison gcc/testsuite/gfortran.dg/substr_6.f90 @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 84e7813d76e9
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 ! { dg-do run }
2 ! { dg-options "-std=legacy" }
3 !
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" /)
8
9 c = c0(1)(-5:-8)
10 if (c(1) /= " ") call abort()
11 c = (/ c0(1)(1:5) /)
12 do i=1,5
13 if (c(1)(i:i) /= c1(i)) call abort()
14
15 ! Make NULs visible (and avoid corrupting text output).
16 if (c(1)(i:i) == ACHAR(0)) then
17 print "(a,$)", "<NUL>"
18 else
19 print "(a,$)", c(1)(i:i)
20 end if
21 end do
22
23 print *, ""
24
25 end