This is the mail archive of the
mailing list for the GCC project.
Re: changing "configure" to default to "gcc -g -O2 -fwrapv ..."
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: gdr at integrable-solutions dot net (Gabriel Dos Reis)
- Cc: pinskia at physics dot uc dot edu dot integrable-solutions dot net (Andrew Pinski), iant at google dot com (Ian Lance Taylor), eggert at CS dot UCLA dot EDU (Paul Eggert), autoconf-patches at gnu dot org, bug-gnulib at gnu dot org, gcc at gcc dot gnu dot org, dnovillo at redhat dot com
- Date: Fri, 29 Dec 2006 12:32:23 -0500 (EST)
- Subject: Re: changing "configure" to default to "gcc -g -O2 -fwrapv ..."
> | > If the above is the only without Autoconf change, I would highly
> | > recommend Autoconf change if GCC optimizers highly value benchmarks
> | > over running real world code.
> | Which one, mine or Paul's?
> If what you propose is the only way out, and there is no way to make
> GCC optimizers reasonable, then I believe Paul's proposal is the next
But that still does not address the issue is that this is not just about
GCC any more since autoconf can be used many different compilers and is right
now. So if you change autoconf to default to -fwrapv and someone comes alongs
and tries to use it with say ACC (some made up compiler right now). The loop
goes into an infinite loop because they treat (like GCC did) signed type overflow
as undefined, autoconf still becomes an issue.
If you want to make the code more readable and maintainable, you can use macros like:
MAX_USING_TYPE(type, othertype, max) \
max = (othertype) _real_max; \
MAX_TYPE(type, max) \
if (sizeof(type)==sizeof(unsigned int))\
MAX_USING_TYPE(unsigned int, type, max);
else if (..... \
printf("Need another integeral type sized, %d\n", sizeof(type)); \
abort (); \
Yes people think macros can be less reabable, but this one case actually makes