https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115864
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- uint16_t ah = a >> 16; uint16_t bh = b >> 16; uint16_t al = a; uint16_t bl = b; uint32_t q = ah * bl; uint32_t r = al * bh; You have a signed integer overflow here. Ah*al is really ((int)ah)*((int)al) due to integer promotion in c.