https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69984
--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> --- 0x7fff * 0x7ffff is 0x3fff0001 and that is representable in int, so there is no overflow. 0xb504 * 0xb504 is 0x7ffea810 and thus also representable in int, no overflow. 0xb505ULL * 0xb505ULL is 0x80001219ULL, which is not representable in int, thus 0xb505 * 0xb505 has signed multiplication overflow and undefined behavior.