|
From: | Richard Guenther |
Subject: | Re: changing "configure" to default to "gcc -g -O2 -fwrapv ..." |
Date: | Sun, 31 Dec 2006 20:21:45 +0100 |
On 12/31/06, Robert Dewar <address@hidden> wrote:
Paul Eggert wrote: > The question is not whether GCC should support wrapv > semantics; it already does, if you specify -fwrapv. > The question is merely whether wrapv should be the default > with optimization levels -O0 through -O2. That over simplifies, because it presents things as though there are only two possibilities 1. Allow "undefined" optimizations without restriction 2. Forbid all such optimizations by specifying fwrapv Quite a few of us (including certainly me, and I think Richard) argue for a mid ground where We don't insist on full fwrapv semantics (because we think it will hurt code equality, particularly in the loop invariant case). We are judcious in applying the optimization in other cases in a pragmatic attempt to keep "traditional" C code working in practice.
I think this is a fragile and not very practical approach. How do you define these "traditional" cases? I guess you would keep the other two as well, so have the mid ground default, -fno-wrapv do what we have now and -fwrapv disable all the optimizations. I'd rather enable -fwrapv at -O1 and keep -O2 as is. This is what we also do for strict-aliasing, it's enabled at -O2 and beyond only (for C, that is). Of course with -O1 the VRP pass is not run, so it might be that the reported problems do not show up with -O1 - and as they are reportedly not for performance critical code they should maybe just use -O1 as autoconf default. Richard.
[Prev in Thread] | Current Thread | [Next in Thread] |