"Dave Korn" <[EMAIL PROTECTED]> 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.