[cfe-dev] david's integer overflow stuff
Chris Lattner
clattner at apple.com
Fri Sep 10 14:43:13 PDT 2010
this has nothing to do with John's patch, so I'm retitling the subject.
On Sep 10, 2010, at 11:44 AM, David Chisnall wrote:
> I was going to comment that this isn't the same behaviour as -ftrapv, but apparently it now is.
Yes, -ftrapv is a flag defined by gcc, clang follows the gcc behavior.
> Chris, I note that you made this change last month, without any discussion, removing the original, generic, behaviour that was discussed on-list, in favour of GCC's more limited behaviour which does not provide options for recovery.
I thought that I emailed you or cc'd you on the commit. But yes you're right. -ftrapv is a gcc flag and we got numerous bug reports from people who were trying to use it and getting link errors.
> The clang -ftrapv implementation was used by us for implementing overflow checking and correction, and was to prototype CERT's as-if infinitely ranged integer model, which has been proposed for inclusion in C1X.
>
> Perhaps you could be a bit clearer about why you originally agreed to this inclusion, and then later (once we had deployed code using it) decided to unilaterally modify it?
I didn't realize that you were implementing it in a gcc compatible way.
> If you feel that the option should have precisely the same semantics as gcc's -ftrapv rather than a superset of that functionality, then you could commit the default handler (which I supplied with the original version of the code), which mimics gcc's functionality by calling abort from the handler.
The problem is that it isn't a superset of the gcc behavior. The GCC behavior allows you to rebuild with a flag and find bugs. Your implementation requires you to implement a new function in your program.
-Chris
More information about the cfe-dev
mailing list