[Bug middle-end/40726] [4.5 Regression] miscompilation at -O1
--- Comment #1 from jv244 at cam dot ac dot uk 2009-07-12 14:20 --- Created an attachment (id=18180) -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18180action=view) testcase correct results with gfortran -c -O0 PR40726.f90 wrong code with gfortran -c -O1 PR40726.f90 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40726
[Bug middle-end/40726] [4.5 Regression] miscompilation at -O1
-- jv244 at cam dot ac dot uk changed: What|Removed |Added Target Milestone|--- |4.5.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40726
[Bug middle-end/40726] [4.5 Regression] miscompilation at -O1
--- Comment #2 from rguenth at gcc dot gnu dot org 2009-07-12 14:24 --- Do you by chance return pointers in any function? In which case you should try removing DECL_IS_MALLOC (fndecl) = 1 in trans-decl.c. I pointed this out to Paul already, but appearantly it is still stuck in his whole-file patch queue. -- rguenth at gcc dot gnu dot org changed: What|Removed |Added Target Milestone|4.5.0 |--- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40726
[Bug middle-end/40726] [4.5 Regression] miscompilation at -O1
-- rguenth at gcc dot gnu dot org changed: What|Removed |Added Target Milestone|--- |4.5.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40726
[Bug middle-end/40726] [4.5 Regression] miscompilation at -O1
--- Comment #3 from jv244 at cam dot ac dot uk 2009-07-12 14:30 --- (In reply to comment #2) Do you by chance return pointers in any function? In which case you should try removing DECL_IS_MALLOC (fndecl) = 1 in trans-decl.c. I pointed this out to Paul already, but appearantly it is still stuck in his whole-file patch queue. yes, this happens here: FUNCTION cp_sll_val_get_first_el(sll,error) RESULT(res) TYPE(cp_sll_val_type), POINTER :: sll TYPE(cp_error_type), INTENT(inout) :: error TYPE(val_type), POINTER :: res and in several other places, I'll see if I can remove the statement you mention. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40726
[Bug middle-end/40726] [4.5 Regression] miscompilation at -O1
--- Comment #4 from rguenth at gcc dot gnu dot org 2009-07-12 14:30 --- Instead, if the Fortran return type does not have POINTER, TARGET or ALLOCATABLE attributes the middle-end type for the result-decl should have TYPE_RESTRICT set if it is a pointer. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40726
[Bug middle-end/40726] [4.5 Regression] miscompilation at -O1
--- Comment #5 from jv244 at cam dot ac dot uk 2009-07-12 14:35 --- In which case you should try removing DECL_IS_MALLOC (fndecl) = 1 in trans-decl.c. this matches twice (line 1565 and line 1429). Which one should be removed ? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40726
[Bug middle-end/40726] [4.5 Regression] miscompilation at -O1
--- Comment #6 from rguenth at gcc dot gnu dot org 2009-07-12 14:58 --- Both. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40726
[Bug middle-end/40726] [4.5 Regression] miscompilation at -O1
--- Comment #7 from jv244 at cam dot ac dot uk 2009-07-12 15:06 --- (In reply to comment #6) Both. This seems to fix the issue, indeed. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40726