public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/44384] New: builtin_object_size_ treatment of multidimensional arrays is unexpected
@ 2010-06-02 15:14 meklund at cisco dot com
0 siblings, 0 replies; only message in thread
From: meklund at cisco dot com @ 2010-06-02 15:14 UTC (permalink / raw)
To: gcc-bugs
Instead of treating each dimension of the array as a separate subobject, BOSC
treats them all as a single subobject which results in unexpected size
calculations. For example, the below code compiled with '-O2' in gcc 4.5.0
gives the following results with expect results listed after.
char c[10][20];
__builtin_object_size(c, 3); /* returns 200, expected 200*/
__builtin_object_size(c[0], 3); /* returns 200, expected 20 */
__builtin_object_size(c[1], 3); /* returns 180, expected 20 */
__builtin_object_size(c[2], 3); /* returns 160, expected 20 */
__builtin_object_size(c[8], 3); /* returns 40, expected 20 */
__builtin_object_size(c[9], 3); /* returns 20, expected 20 */
--
Summary: builtin_object_size_ treatment of multidimensional
arrays is unexpected
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: meklund at cisco dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44384
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-06-02 15:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-02 15:14 [Bug c/44384] New: builtin_object_size_ treatment of multidimensional arrays is unexpected meklund at cisco dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).