> On Thu, 25 Jul 2013, Ted Unangst wrote:
> 
> >Thanks, these are bugs worth fixing in any case, but the native gcc on
> >OpenBSD has these optimizations disabled. fyi. (it also has the ident
> >string feature disabled, fwiw.)
> 
> Indeed, good point for this particular case, though even gcc-4.2.1
> (used by OpenBSD) makes undefined behavior optimizations in other
> cases, such as pointer overflow (see below).
> 
> As you mentioned, these bugs might be worth fixing anyway, in case
> OpenBSD decides to support a compiler other than gcc-4.2.1 (perhaps
> a recent version of Clang, which performs more aggressive
> optimizations).

We used to have -fwrapv the default, but it caused odd behaviours in
some third-party binaries, so this was replaced with a default
-fno-strict-overflow.

But apparently some form of -fwrapv is still required (your example case
will compile the test and the call to foo() if -fwrapv).

Miod

Reply via email to