[Bug c/53424] dynamic array expressions get wrong sizeof() if pointers to const are involved and the pointers are changed (const is misapplied to the whole expression)

gccbug at shaggy dot cc gcc-bugzilla@gcc.gnu.org
Sun May 20 06:13:00 GMT 2012


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

--- Comment #1 from Frank Barrus <gccbug at shaggy dot cc> 2012-05-20 05:31:02 UTC ---
Of particular attention, look at the example function "negativesizeof2".
It's not just the sizeof() function returning the incorrect size.  In this
case, the pointer change retroactively changed the size of a struct already
declared, and which a variable was instantiated from.  And it didn't just
change it for sizeof().  Pointer arithmetic is actually wrong, and the size is
negative.  So a step forward actually goes backwards!



More information about the Gcc-bugs mailing list