------- Comment #5 from dominiq at lps dot ens dot fr  2007-10-11 09:38 -------
After applying the patch and the one to PR33727 (thanks Paul!-), the first test
fails at runtime:

At line 6 of file pr32703_1.f90
Fortran runtime error: Different CHARACTER lengths (1/2) in array constructor

but the following code

program array_char
implicit none
character (len=2) :: x, y
character (len=2) :: z(2)
x = "a "
y = "cd"
z = (/y(1:len(trim(y))), x(1:len(trim(x)))/)  ! causes segfault
print *, "'", z(1), "'  '", z(2), "'"
end program array_char

gives

[karma] f90/bug% gfc -fbounds-check pr33727_bad.f90
[karma] f90/bug% a.out 
 'cd'  'a'

I am expecting this test to fail at runtime and the other one. Am I missing
something.

I have also noticed something strange with the following valid(?) code:

program array_char
implicit none
character (len=2) :: x, y
character (len=2) :: z(2)
x = "a "
y = "cd"
z = "  "
z = (/y(1:len(trim(x))), x(1:len(trim(x)))/)
print *, "'", z(1), "'  '", z(2), "'"
end program array_char

which gives

 'c'  'a'

while I am expecting

 'c '  'a '

Looks like another bug, should I fill a new PR?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33254

Reply via email to