[cfe-dev] Integer overflow checking

Martin Doucha next_ghost at quick.cz
Sat May 16 16:17:44 PDT 2009


Eli Friedman napsal(a):
> This is wrong: one, unsigned "overflow" is well-defined, and two,
> CodeGen takes some shortcuts with inc/dec, so this will incorrectly
> conclude that "short x = 0x7FFF; ++x;" overflows.
>
> -Eli

Perhaps I should clarify. The goal of my thesis is to detect and report 
newbie mistakes. That includes unsigned overflow because although it's 
well defined, it's almost certainly a mistake in newbie code. What 
language standard says about the behavior is one thing. Whether or not 
it's considered a bug in actual code is quite another. Anyway, you're 
free to do anything you wish with that patch.

Regards,
Martin Doucha



More information about the cfe-dev mailing list