[PATCH][4.3] Deprecate -ftrapv

Richard Guenther rguenther@suse.de
Sat Mar 1 14:10:00 GMT 2008


On Sat, 1 Mar 2008, Richard Kenner wrote:

> > int f(int a, int b) { return 0 * (a + b); }
> > 
> > get the potentially trapping arithmetic folded away.  If -ftrapv is to 
> > have properly defined semantics, those must include trapping if (a + b) 
> > overflows in the above code.
> 
> Why?  Is there any language that requires such semantics?

Not exactly.  -ftrapv semantics are defined _very_ sparsely.

"This option generates traps for signed overflow on addition,
subtraction and multiplication operations."

it doesn't say if it preserves traps on dead code, so Josephs
interpretation is one possible valid one.

Richard.



More information about the Gcc-patches mailing list