Signed overflow optimization hazards in the kernel
Signed overflow optimization hazards in the kernel
Posted Aug 18, 2012 22:56 UTC (Sat) by jzbiciak (guest, #5246)In reply to: Signed overflow optimization hazards in the kernel by cmccabe
Parent article: Signed overflow optimization hazards in the kernel
Where I've heard it coming up is when you have code that effectively looks like this:
for (i = x; i < x + 16; i++)
{
/* code that does not modify either x or i */
}
The compiler wants to know it's safe to assume this loop goes around 16 times. That isn't true if "x + 16" could overflow.
