Patch to detect invalid and missing ATTRIBUTE const/pure [take 2]

Richard Henderson rth@redhat.com
Sun Mar 24 20:51:00 GMT 2002


On Sun, Mar 24, 2002 at 08:30:23PM -0800, Zack Weinberg wrote:
> I don't think failure to return invalidates const/pure-ness.  If we
> are considering moving or merging a call to a const/pure function, and
> it is going to fail to return in one context, it is going to fail to
> return in the other context too (or we wouldn't have done the
> optimization at all).  So the optimization remains safe: the program
> still has the same semantics.

No.  const functions may be moved outside a loop, and if left 
inside the loop, may never be reached.


r~



More information about the Gcc-patches mailing list