This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: -funsafe-loop-optimizations
On Sun, 02 Jan 2005 09:32:55 -0500, Robert Dewar <dewar@adacore.com> wrote:
> Kai Henningsen wrote:
>
> > 1. Assert somehow which calculations are/aren't supposed to overflow/wrap
> > (where I care)
> >
> > 2. Option A, have the compiler insert checking code to make sure, at
> > runtime, that what I asserted actually holds
> >
> > 3. Option B, have the compiler rely on my assertions for optimal
> > optimization
> >
> > 4. While I don't see an obvious use, presumably someone will also want
> > option C, ignore my assertions.
> >
> > And yes, I know where to find Pascal ;-)
>
> You will do even better with Ada, which has all the above capabilities
> and more :-)
>
> The trouble with trying to do this in C is that it is really a
> substantial language capability that you are trying to bolt on, and
> it is hard to do that cleanly if it is not in the original language
> design.
Well, this is just the builtin_true() that will transform
if (!builtin_true(n == MAX_UNSIGNED))
abort();
to nothing in case 3, and of course VRP and other optimizations
take advantage about the fact.
Richard.