------- Comment #16 from tobi at gcc dot gnu dot org 2007-10-21 21:18 ------- Re this testcase: (In reply to comment #5) > 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
Changing z's length to, say, 5 shows that the strings are correctly padded, i.e. z(1) == "cd " after the assignment, so there's only an issue with bounds-checking not working on this code, it doesn't expose another bug. I've yet to figure out how to evaluate the string length, and only evaluate it once. Dominique has correctly identified one of the crucial parts of the code in #14. I hope I can look at this tomorrow night or Wednesday night. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33254