[PATCH][4.3] Deprecate -ftrapv

Paolo Bonzini bonzini@gnu.org
Sat Mar 1 14:15:00 GMT 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 C, since trapping overflow is just one facet of "undefined behavior" 
and we can define that facet as we wish! :-)

Paolo



More information about the Gcc-patches mailing list