This is the mail archive of the
mailing list for the GCC project.
Re: changing "configure" to default to "gcc -g -O2 -fwrapv ..."
Ian Lance Taylor <email@example.com> writes:
> I don't think -frisky is a good name for that option.
Aaaaww. Nobody will remember boring and forbidding option names like
-fstrict or -fstandard. Everybody will remember -frisky. Where's
your sense of pun and -foetry?
Anyway, thanks for your summary of the current situation. I've
written up something along those lines nin the Autoconf manual and
will CC: it to the gcc list (in a separate message) for everybody's
wise review. One question, though:
> 3) We perform algebraic simplifications based on the assumption that
> signed arithmetic in the program never overflows. We can safely
> translate ((X * 10) / 5) to (X / 2) because we assume that X * 10
> will not overflow.
In practice, I've noticed that this optimization is not done if
X * 10 is put into a temporary first. E.g.:
int i = INT_MAX / 2000 + 1;
int i2000 = i * 2000;
printf ("%d %d\n", i, i2000 / 1000);
does not rewrite i2000 / 1000 to i * 2 on any of the compilers I have
ready access to.
This assumption that wraparound can be assumed for values put into
explicit temporaries has been documented in the Autoconf manual for
some little time. Obviously the assumption relies on a common
extension to the C standard; do you think that's a reasonably safe
assumption these days?