This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/56956] ftrapv traps on valid abs-like code
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 22 Oct 2015 12:09:10 +0000
- Subject: [Bug c/56956] ftrapv traps on valid abs-like code
- Auto-submitted: auto-generated
- References: <bug-56956-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56956
--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
Yeah, unfortunately that doesn't look correct :(
I've always wanted to have an ABS_EXPR variant that returns an unsigned value
(so with no undefined behavior). Maybe just overload ABS_EXPR in this way.
You'd need to assure expansion doesn't use absv optabs, that is, trapping
behavior / undefinedness would depend on the ABS_EXPR result type. The
argument type would still be signed.