[Bug c++/12200] Nonintuitive behavior with __attribute__((packed))

rearnsha at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Mon Sep 29 14:17:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


rearnsha at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


------- Additional Comments From rearnsha at gcc dot gnu dot org  2003-09-29 12:52 -------
This is exactly what the specification of packed implies.  If you want a
specific instance of a packed object to be more aligned, then you can add
alignment in its declaration, hence:

extern const short a = 1;

struct TPacked {
  short b;
  short c;
  int d;
} __attribute__((packed));

extern const TPacked e __attribute__((aligned(4))) = { 2, 3, 4 };



More information about the Gcc-bugs mailing list