https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61893
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed by sth like
Index: fold-const.c
===================================================================
--- fold-const.c (revision 212388)
+++ fold-const.c (working copy)
@@ -1121,7 +1121,12 @@
STRIP_NOPS (arg2);
if (TREE_CODE (arg1) == INTEGER_CST)
- return int_const_binop (code, arg1, arg2);
+ {
+ tree res = int_const_binop (code, arg1, arg2);
+ if (res && TYPE_OVERFLOW_TRAPS (TREE_TYPE (arg1)) && TREE_OVERFLOW
(res))
+ return NULL_TREE;
+ return res;
+ }
if (TREE_CODE (arg1) == REAL_CST)
{