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: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: Andrew Pinski <pinskia at physics dot uc dot edu>
- 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: 29 Dec 2006 19:00:40 +0100
- Subject: Re: changing "configure" to default to "gcc -g -O2 -fwrapv ..."
- References: <200612291732.kBTHWNkC024013@localhost.localdomain>
Andrew Pinski <pinskia@physics.uc.edu> writes:
| >
| > | > 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
| > option.
|
| 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.
The Autoconf change, as I see it, is to active switches when enough
recent version of GCC is detected as I understand it is the primary
compiler at issue.
| 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:
CPP hackery seldom repairs a fundamentally problematic construct.
|
| 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 (..... \
| else \
| {
| 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
| it readable.
I dispute it is readable. More fundamentally, I don't see how that
magically becomes more portable, and maintainable. The set of
built-in integer types is NOT given by a closed list. I posit that
any solution based on sizeof hackery is fundamentally non-portable and
broken.
-- Gaby