[Bug c/27214] The C frontend introduces undefined pointer overflow

rguenth at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Wed Apr 19 15:13:00 GMT 2006



------- Comment #2 from rguenth at gcc dot gnu dot org  2006-04-19 15:13 -------
"-CST" in this case is unsigned 4294967292, it just happens to be printed as
-4B.
So the addition wraps, as it is done using unsigned arithmetic.  Writing

char *foo(char *p)
{
  return p + 4294967292;
}

results in the same

  D.1523 = p + -4B;

but the above source would be invalid due to the wrapping pointer.  Now the
middle-end in some places assumes/assumed that pointers do not wrap.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27214



More information about the Gcc-bugs mailing list