[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: changing "configure" to default to "gcc -g -O2 -fwrapv ..."
From: |
Ian Lance Taylor |
Subject: |
Re: changing "configure" to default to "gcc -g -O2 -fwrapv ..." |
Date: |
24 Mar 2007 11:43:49 -0700 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 |
Robert Dewar <address@hidden> writes:
> Ian Lance Taylor wrote:
>
> > The new option -fstrict-overflow tells gcc that it can assume the
> > strict signed overflow semantics prescribed by the language standard.
> > This option is enabled by default at -O2 and higher. Using
> > -fno-strict-overflow will tell gcc that it can not assume that signed
> > overflow is undefined behaviour. The general effect of using this
> > option will be that signed overflow will become implementation
> > defined. This will disable a number of generally harmless
> > optimizations, but will not have the same effect as -fwrapv.
>
> Can you share the implementation definition (implementation defined
> generally means that the implementation must define what it does).
> This seems awfully vague.
You're right, I shouldn't have said "implementation defined."
What will happen with -fno-strict-overflow is whatever the processor
ISA happens to do when a signed arithmetic operation overflows. For
ordinary machines it will just wrap.
It is intentionally vague. If you need non-vague semantics, you
should use -fwrapv. -fno-strict-overflow is intended to provide the
vague semantics which C compilers have historically provided, in
support of existing code. -fstrict-overflow provides the reasonably
precise semantics of the language standard. The options are generally
analogous to -fstrict-aliasing and -fno-strict-aliasing.
Ian