http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46619
--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> 2010-11-23 20:24:00 UTC --- uv = (unsigned int)((int)x[1 + j] * (int)x[1 + i]); Is what the C standard says should be done as unsigned short is smaller than int so it is promoted to int. So we have a 16x16 unsigned to a 31+1 multiple which can overflow.