This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Bug tree-optimization/19723] [4.0 Regression] A side effect is missed in 0 % a++.


On Tue, 1 Feb 2005, Paolo Bonzini wrote:

> > What I think we really want is to know whether or not the language
> > requires trapping on a DIV/MOD by zero. If so, then disable this class
> > of optimizations, otherwise we have a non-conformant program.
> 
> May this fall into flag_unsafe_math_optimizations?

-funsafe-math-optimizations is documented to affect floating-point 
operations, % is an integer-only operation.

-ftrapv is documented to be only for signed overflow on addition, 
subtraction and multiplication, but it still seems a better match for an 
option to guarantee runtime traps for all undefined behavior in integer 
operations - including / and % by 0 and INT_MIN / -1.  However we need to 
allow for any requirements non-C languages might have for traps on 0 % 0 
without wanting all the effects of -ftrapv.

-- 
Joseph S. Myers               http://www.srcf.ucam.org/~jsm28/gcc/
    jsm@polyomino.org.uk (personal mail)
    joseph@codesourcery.com (CodeSourcery mail)
    jsm28@gcc.gnu.org (Bugzilla assignments and CCs)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]