This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: assertify mn10300
- From: Nathan Sidwell <nathan at codesourcery dot com>
- To: Roger Sayle <roger at eyesopen dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Alexandre Oliva <aoliva at redhat dot com>,Zack Weinberg <zack at codesourcery dot com>
- Date: Sun, 08 May 2005 17:44:37 +0100
- Subject: Re: assertify mn10300
- References: <Pine.LNX.4.44.0505081009400.13331-100000@www.eyesopen.com>
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