This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


> 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]