__assert_fail should not be __attribute__((__noreturn__))

Johannes Sixt johannes.sixt@telecom.at
Mon Apr 5 20:37:00 GMT 2004


On Montag, 5. April 2004 19:30, Richard Henderson wrote:
> On Sun, Apr 04, 2004 at 10:46:09PM -0400, Daniel Jacobowitz wrote:
> > You might want to look at what GCC can use the noreturn marker for.
> > Branch prediction and block reordering, for instance.
>
> Actually, the most important thing is that GCC can prove that the
> assert condition is false after the assertion.  This knowledge gets
> propagated into following statements.

These optimization opportunities are only available if assert() is used, but 
NDEBUG is _not_ used. That is, the optimzed code is payed with the runtime 
needed to evaluate the condition.

This makes no sense to me. I still think that if performance is needed, 
-DNDEBUG is the best optimization.

Is there so much software that benefits from unelided assert() expressions 
that removing noreturn is not an option?

-- Hannes



More information about the Libc-alpha mailing list