[Bug c/44384] New: builtin_object_size_ treatment of multidimensional arrays is unexpected
meklund at cisco dot com
gcc-bugzilla@gcc.gnu.org
Wed Jun 2 15:14:00 GMT 2010
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
More information about the Gcc-bugs
mailing list