public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rearnsha at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/51568] Enum value is not extracted properly via a union Date: Thu, 15 Dec 2011 17:28:00 -0000 [thread overview] Message-ID: <bug-51568-4-KNPUFYcKc6@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-51568-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51568 Richard Earnshaw <rearnsha at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |INVALID --- Comment #1 from Richard Earnshaw <rearnsha at gcc dot gnu.org> 2011-12-15 17:17:34 UTC --- On linux sizeof (struct rec) is 7, so how do you expect an unsigned (size = 4) to hold the entire value? If you want a packed enum, you need to specify the packed on the element declaration, not just on the overall structure: struct rec { unsigned short w; unsigned char c; enum en e __attribute__((packed)); } __attribute__((packed));
next prev parent reply other threads:[~2011-12-15 17:18 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-12-15 15:57 [Bug c/51568] New: " eugene at hutorny dot in.ua 2011-12-15 17:28 ` rearnsha at gcc dot gnu.org [this message] 2011-12-15 17:31 ` [Bug c/51568] " rearnsha at gcc dot gnu.org 2011-12-15 20:07 ` eugene at hutorny dot in.ua 2011-12-16 11:09 ` eugene at hutorny dot in.ua
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-51568-4-KNPUFYcKc6@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).