[PATCH][4.3] Deprecate -ftrapv

Robert Dewar dewar@adacore.com
Sat Mar 1 14:15:00 GMT 2008


Richard Guenther wrote:
> 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.

And anyway, no point in doing energetic exergesis on vague language
defining an option that has never worked anyway :-)

Part of "fixing" -ftrapv should be to carefully document exactly
what it does/is-intended-to-do (hopefully those are the same :-))
> 
> Richard.



More information about the Gcc mailing list