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/44384] New: builtin_object_size_ treatment of multidimensional arrays is unexpected


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


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