This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/32140] [4.3 Regression] Miscompilation with -O1
- From: "pault at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Jun 2007 17:54:02 -0000
- Subject: [Bug fortran/32140] [4.3 Regression] Miscompilation with -O1
- References: <bug-32140-6642@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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