https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87276
--- Comment #1 from Vincent Lefèvre <vincent-gcc at vinc17 dot net> --- I could simplify the code: #include <stdio.h> #include <stdlib.h> struct s { long e; }; static void f (struct s *ps) { volatile long m = 9223372036854775807; const char *str = "11E"; int r; long sum; ps->e = 0; for (;;) { if (*str++ != '1') break; ps->e ++; } r = 1; sum = m; printf ("%ld\n", sum); if (sum >= 0 && ps->e >= 0) { unsigned long uc; uc = (unsigned long) sum + (unsigned long) ps->e; if (uc > 9223372036854775807) r = 2; else sum = 17; } else sum = sum + ps->e; printf ("%ld\n", sum); printf ("%d\n", r); if (r != 2) exit (1); ps->e = sum; } int main (void) { struct s s; f (&s); return 0; } $ gcc-snapshot -O2 tst.c -o tst $ ./tst 9223372036854775807 17 1 zsh: exit 1 ./tst instead of 9223372036854775807 9223372036854775807 2