This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/19917] [4.0 regression] Weak const function mishandled inside loop
- From: "roger at eyesopen dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Feb 2005 19:31:02 -0000
- Subject: [Bug tree-optimization/19917] [4.0 regression] Weak const function mishandled inside loop
- References: <20050212002429.19917.schwab@suse.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From roger at eyesopen dot com 2005-02-12 19:31 -------
Andreas, thanks for the bigger example, I can now reproduce this failure!
I was wondering whether you could try the following patch to see if helps
for you.
Index: tree-eh.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-eh.c,v
retrieving revision 2.24
diff -c -3 -p -r2.24 tree-eh.c
*** tree-eh.c 18 Jan 2005 11:36:24 -0000 2.24
--- tree-eh.c 12 Feb 2005 19:20:44 -0000
*************** tree_could_trap_p (tree expr)
*** 1840,1845 ****
--- 1840,1852 ----
return true;
return false;
+ case CALL_EXPR:
+ t = get_callee_fndecl (expr);
+ /* Assume that calls to weak functions may trap. */
+ if (!t || !DECL_P (t) || DECL_WEAK (t))
+ return true;
+ return false;
+
default:
/* Any floating arithmetic may trap. */
if (fp_operation && flag_trapping_math)
Basically, this teaches tree_could_trap_p that calls to weak functions may
potentially trap. This is sufficient to prevent tree-ssa-loop-im.c from
moving the call before the test. It feels like the right fix. I'm currently
bootstrapping and regression testing on i686-pc-linux-gnu and ia64-linux.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2005-02-12 19:31:01
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19917