[RFC/PATCH] Optimize code based on asserts even in NDEBUG mode

Joseph S. Myers jsm@polyomino.org.uk
Fri Apr 9 20:06:00 GMT 2004


On Fri, 9 Apr 2004, Paolo Bonzini wrote:

> This patch optimizes code in NDEBUG mode based on the conditions
> that the program asserts.  This patch, in other words, allows a
> function like this

Is this meant to be branch-prediction optimization (the asserted condition
is probably, but not necessarily, true), or presuming it to be true after
the assert?  ISO C says assert expands to ((void)0) in NDEBUG mode, so you
can't presume anything about the truth of the expression asserted
afterwards.

-- 
Joseph S. Myers
jsm@polyomino.org.uk



More information about the Gcc-patches mailing list