https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68021
--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> --- void bar (void); void foo (int p2, int p3) { unsigned long a = p2; unsigned long b = (~(unsigned long) ((unsigned int) p3 + -1U)) + a; unsigned long c = (a - (unsigned long) ((unsigned int) p3 + -1U)) + (-1UL); if (b != c) bar (); } shows this folding inconsistency in the *.original dump: long unsigned int a = (long unsigned int) p2; long unsigned int b = (a - (long unsigned int) ((unsigned int) p3 + 4294967295)) - 1; long unsigned int c = (a - (long unsigned int) ((unsigned int) p3 + 4294967295)) + 18446744073709551615; but *.gimple already canonicalizes it, so that it does + 18446744073709551615 at the end in both cases.