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: Paul Eggert <eggert at CS dot UCLA dot EDU>
- To: <autoconf-patches at gnu dot org>, <bug-gnulib at gnu dot org>, <gcc at gcc dot gnu dot org>
- Date: Sat, 30 Dec 2006 21:57:20 -0800
- Subject: Re: changing "configure" to default to "gcc -g -O2 -fwrapv ..."
- References: <019301c72c4d$60a18310$a501a8c0@CAM.ARTIMI.COM>
"Dave Korn" <dave.korn@artimi.com> writes:
> Maybe the answer (as far as autoconf goes) is that autoconf tests should be
> compiled at -O0.
No, since one of the first rules of Autoconf is that you should test
the compiler with the same options that you intend to use use when
compiling. Otherwise there are too many cases where compilers would
behave differently during testing than during actual compilation, and
the differences can wreak havoc on the code.
> (Maybe they could be compiled at -O0 *and* at -O2, and the results
> compared, to infer overflow behaviour and decide whether to add
> -fwrapv to the generated CFLAGS?)
That's an interesting suggestion, but it sounds a bit tricky,
since it'd mean Autoconf would have to track GCC's optimization
strategies fairly closely. For example, if gcc -O2 enabled some
new optimization that broke wrapv assumptions in a different
way, we'd need to modify Autoconf to add a test case to detect
this.