the bug is in sizeof(element) - i've made unlucky structure, some
time ago, where sum of sizeof(each_element) gives size of 14 and
sizeof(whole_struct) returns 16. on old gcc-2.9.x there was the same
problem.
as an example program i've wrote shor one, that shows sizeof() from
struct having 14 char's table, 'unlucky' struct and sum of all elements sizes.

// sizeof(a)==16B instead of 14B...
struct a
{
 char           bfType[2];// 2B
 unsigned long  bfSize;// 4B
 unsigned short bfReserved1;// 2B
 unsigned short bfReserved2;// 2B
 unsigned long  bfOffBits;// 4B
};


// sizeof(b)==14B - OK!
struct b
{
 char nothing[14];
};


-- 
           Summary: sizeof(struct) fails for 'unlucky' structure
           Product: gcc
           Version: 3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: warg0d at go2 dot pl
 GCC build triplet: x86
  GCC host triplet: x86
GCC target triplet: x86


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

Reply via email to