This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: assertify mn10300


Roger Sayle wrote:

> Alex's concern stems from the blind replacement of checks of the form
> "if (expr) abort", with the almost equivalent "gcc_assert (!expr)."
> The potential problems arise when expr has required side-effects.

ok, that makes sense.

> One possible improvement might be for GCC to introduce a
> __builtin_sideeffects_p builtin, along the same lines as the current
> __builtin_constant_p builtin, that could be used in the definition
> of the gcc_assert macro to check at compile time that it doesn't
> contain a side-effecting expression.

This would be helpful, but might prove difficult in the face of
valid asserts of the form
	assert (!find_note (...));
It's rather difficult to distinguish that from an invalid
	assert (validate_change (...));
I suppose if we properly annotate find_note as a pure function ...

nathan
-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]