------- Comment #14 from pault at gcc dot gnu dot org 2007-06-17 17:54 ------- A slight modification of the example in comment #2:
MODULE TEST CONTAINS FUNCTION s2a_3(s1) RESULT(a) CHARACTER(LEN=*), INTENT(IN) :: s1 CHARACTER(LEN=LEN(s1)) :: a(3) a(1)=s1 END FUNCTION END MODULE USE TEST character(LEN=1000) :: b(3) b=s2a_3(REPEAT("1",101)) write(6,*) b(1) END yields something that works at any level of optimization. Note that the main program remains untouched, except for all the code that comes from the interface evaluation of the character length. Oddly, the POINTER_PLUS bit remains unchanged. I have stared at the code, trying to understand where an optimization senstivity might come in, with no success. Perhaps, somebody smarter than me will see the difference. Paul -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32140