http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47348
Summary: substring with len_trim in array constructor
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: fortran
AssignedTo: [email protected]
ReportedBy: [email protected]
Blocks: 19276
This one is strange; it is with recent trunk.
ig25@linux-fd1f:~/Krempel/Char-4> cat foo.f90
program main
implicit none
character(len=3) :: c(3)
c = 'x'
print '(3(A,"|"))', (/ (/ trim(c(1)), 'a' /)//'c', 'cd' /)
print '(3(A,"|"))', (/ (/ c(1)(1:len_trim(c(1))), 'a' /)//'c', 'cd' /)
print '(3(A,"|"))', (/ (/ c(1)(1:1), 'a' /)//'c', 'cd' /)
end program main
ig25@linux-fd1f:~/Krempel/Char-4> gfortran foo.f90
ig25@linux-fd1f:~/Krempel/Char-4> ./a.out
xc|ac|cd|
x |a |cd|
xc|ac|cd|
The second line should be identical to the first and third one.
Modified from nested_array_constructor_2.f90, BTW.
Goes back at least to 4.4.1, so probably not a regression.