[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: changing "configure" to default to "gcc -g -O2 -fwrapv ..."

From: Paul Eggert
Subject: Re: changing "configure" to default to "gcc -g -O2 -fwrapv ..."
Date: Tue, 02 Jan 2007 15:25:16 -0800
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)

Ian Lance Taylor <address@hidden> 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.:

   #include <limits.h>
   #include <stdio.h>
   int i = INT_MAX / 2000 + 1;

   main (void)
     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?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]