http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60814
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- This is undefined code as 0xffff*0xffff overflows int. x * y is really ((int)x) * ((int)y) So if that overflows and since we know that both (int)x and (int)y are both positive integer since we are converting from unsigned short to int; the result of ((int)x) * ((int)y) will also be positive (since overflow of signed integer is undefined) we can remove the cast between int and unsigned int and go directly to unsigned long long in a valid way.