[cfe-dev] request for comments on patch: detecting integer undefined behaviors
David Chisnall
csdavec at swan.ac.uk
Fri Sep 10 11:44:03 PDT 2010
I was going to comment that this isn't the same behaviour as -ftrapv, but apparently it now is.
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.
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?
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.
I am very disappointed that you decided to reverse your original decision to commit this code without any discussion, just prior to a release.
David
On 10 Sep 2010, at 19:16, John Regehr wrote:
> Attached is a very small Clang patch that augments -ftrapv to check for divide by zero, mod by zero, and INT_MIN % -1. The behavior on failure is inherited from trapv.
>
> Thanks,
>
> John<clang-divrem-113592.patch>_______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
-- Sent from my PDP-11
More information about the cfe-dev
mailing list