This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: changing "configure" to default to "gcc -g -O2 -fwrapv ..."
- From: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- To: dewar at gnat dot com
- Cc: autoconf-patches at gnu dot org, bernds_cb1 at t-online dot de, bug-gnulib at gnu dot org, dewar at adacore dot com, ebb9 at byu dot net, eggert at cs dot ucla dot edu, gcc at gcc dot gnu dot org, gdr at integrable-solutions dot net, pinskia at physics dot uc dot edu, richard dot guenther at gmail dot com
- Date: Sat, 30 Dec 2006 20:50:11 EST
- Subject: Re: changing "configure" to default to "gcc -g -O2 -fwrapv ..."
- References: <20061231010048.0CFA448CC4B@nile.gnat.com>
> if (a - 10 < 20)
>
> Well that particular example is far fetched in code that people
> expect to run efficiently, but with a bit of effort you could
> come up with a more realistic example.
Not at all far-fetched. The normal way these things come up is macros:
#define DIGIT_TO_INT(D) (D - '0')
...
if (DIGIT_TO_INT (a) < 5)
> Compilers are always full of such optimizations which are simple to do
> and get put in without any sound basis for determining that they actually
> help.
Given the pervasiveness of macros of this type, this sort of folding
optimization catches a lot of cases. And the answer to where a lot of
wierd-looking code comes from is also macros.