This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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)


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!


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]