[Bug c++/32016] sizeof(class) always a multiple of 4 on 32 bit machine

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Mon May 21 21:25:00 GMT 2007

------- Comment #3 from pinskia at gcc dot gnu dot org  2007-05-21 22:24 -------
(In reply to comment #2)
> To beat a dead horse again, the data members are suitably aligned in
> Microsoft's struct.  For the GNU folk to say the extra padding is for data
> alignment or is an ABI issue is misleading at best.  It's only an alignment/ABI
> issue if the compiler makes it so by generating code that accesses the structs
> as if they contained ints, probably for quick copying.  But if that's the case,
> I wish they would say that.

struct a33
  struct Char1 a1;
  struct Char1 a2;

And see what size/offset the structs are at.  Again this is an ABI issue and
you did not say what exact target you are compiling for, only arm7 which does
not help because there are many different ABIs for the arm.  (like arm-elf or
arm-coff or arm-eabi).

And if you want a packed struct use the attribute packed, it also packs the



More information about the Gcc-bugs mailing list