[cfe-dev] -ftrapv

David Chisnall csdavec at swansea.ac.uk
Thu Apr 2 05:57:00 PDT 2009


On 2 Apr 2009, at 04:28, Chris Lattner wrote:

> On Apr 1, 2009, at 6:06 PM, Mike Stump wrote:
>
>> On Apr 1, 2009, at 3:54 PM, David Chisnall wrote:
>>> Missed a bit.  The overflow-aware code is called on += and so on,
>>> but didn't know about these cases.  This patch fixes it.
>>
>> Checked in r68267.
>>
>>> I'm now using this
>>
>> You will need to use -ftrapu for SmallTalk.  -ftrapv is for signed
>> values only.
>
> FYI, it is completely inappropriate for Clang to support a -ftrapu  
> option for SmallTalk.  Please remove this.

I'm not sure I understand this comment.  Smalltalk uses signed  
integers, so -ftrapv, not -ftrapu, is appropriate, but -ftrapu can be  
useful in a number of cases, for example in the implementation of  
calloc() which needs to multiply two size_t quantities together and  
check for overflow, and in any other situation involving computation  
of array offsets where some additional checks while debugging might be  
helpful.

What makes the feature inappropriate?  Some rationale, beyond 'FYI'  
would be helpful.

David



More information about the cfe-dev mailing list