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.