This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/12200] Nonintuitive behavior with __attribute__((packed))
- From: "rearnsha at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Sep 2003 12:52:31 -0000
- Subject: [Bug c++/12200] Nonintuitive behavior with __attribute__((packed))
- References: <20030907103858.12200.pgonzalez@bluel.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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 };