This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: bad hoist
From: "David S. Miller" <davem@redhat.com>
Date: Thu, 26 Sep 2002 17:39:39 -0700 (PDT)
Actually, maybe this is not where the fix belongs. It probably
belongs in the place which converts the operands to proper
function call arguments. (ie. if an argument ends up being passed
by reference in memory, convert LCT_CONST to LCT_PURE)
This is the fix I'm testing now:
2002-09-26 David S. Miller <davem@redhat.com>
* calls.c (emit_library_call_value_1): Passing args by reference
converts a CONST function into a PURE one.
--- calls.c.~1~ Wed Sep 25 14:12:21 2002
+++ calls.c Thu Sep 26 17:50:00 2002
@@ -3666,6 +3666,14 @@ emit_library_call_value_1 (retval, orgfu
#endif
;
+ /* If this was a CONST function, it is now PURE since
+ it now reads memory. */
+ if (flags & ECF_CONST)
+ {
+ flags &= ~ECF_CONST;
+ flags |= ECF_PURE;
+ }
+
if (GET_MODE (val) == MEM && ! must_copy)
slot = val;
else if (must_copy)