[LLVMbugs] [Bug 12335] Optimization bug when testing for integer overflows

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Mar 23 03:43:20 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=12335

Duncan Sands <baldrick at free.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |baldrick at free.fr
         Resolution|                            |FIXED

--- Comment #1 from Duncan Sands <baldrick at free.fr> 2012-03-23 05:43:20 CDT ---
Overflowing signed arithmetic does not have a defined result according to the
C standard.  Use unsigned arithmetic instead.  For example:

        token_pos = (int)((unsigned)token_pos + (unsigned)cur_token->pos_inc);

See http://blog.llvm.org/2011/05/what-every-c-programmer-should-know.html
for a discussion of this kind of issue.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list