public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "sven.koehler at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/51628] __attribute__((packed)) is unsafe in some cases Date: Tue, 10 Mar 2015 13:40:00 -0000 [thread overview] Message-ID: <bug-51628-4-t4ZBqPFKv3@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-51628-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51628 --- Comment #24 from Sven <sven.koehler at gmail dot com> --- Comment #4 mentions typedef int myint __attribute__((aligned(1))); That shouldn't even work. The GCC documentation on Type Attributes mentions that "The aligned attribute can only increase the alignment". It goes on to mention the packed attribute, which can be used to decrease alignment. But as far as I know, that attributes was designed for structs. Anyhow, it seems that the aligned attribute is intended for increasing the alignment only - not for decreasing. Yet, when I checked __alignof(myint) with both gcc and clang, it was in fact decreased from 4 to 1. Not sure why. That seems to contradict the documentation.
prev parent reply other threads:[~2015-03-10 13:40 UTC|newest] Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-12-19 23:00 [Bug c/51628] New: " Keith.S.Thompson at gmail dot com 2011-12-19 23:17 ` [Bug c/51628] " Keith.S.Thompson at gmail dot com 2011-12-19 23:38 ` pinskia at gcc dot gnu.org 2011-12-20 0:43 ` Keith.S.Thompson at gmail dot com 2011-12-20 10:22 ` rguenth at gcc dot gnu.org 2011-12-20 10:54 ` ebotcazou at gcc dot gnu.org 2011-12-20 11:19 ` rguenther at suse dot de 2011-12-20 11:20 ` ebotcazou at gcc dot gnu.org 2011-12-20 11:34 ` rguenther at suse dot de 2011-12-20 11:57 ` ebotcazou at gcc dot gnu.org 2011-12-20 12:00 ` rguenther at suse dot de 2011-12-20 12:29 ` ebotcazou at gcc dot gnu.org 2011-12-20 13:11 ` jakub at gcc dot gnu.org 2011-12-20 13:29 ` rguenther at suse dot de 2011-12-20 17:45 ` ebotcazou at gcc dot gnu.org 2013-04-02 0:58 ` peter at axium dot co.nz 2013-04-02 8:30 ` rguenth at gcc dot gnu.org 2013-04-02 8:31 ` rguenth at gcc dot gnu.org 2013-04-02 20:21 ` peter at axium dot co.nz 2013-04-03 7:30 ` ebotcazou at gcc dot gnu.org 2013-04-03 7:55 ` rguenther at suse dot de 2013-04-03 8:51 ` ebotcazou at gcc dot gnu.org 2013-04-03 9:20 ` rguenther at suse dot de 2015-03-10 13:29 ` sven.koehler at gmail dot com 2015-03-10 13:40 ` sven.koehler at gmail dot com [this message]
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-51628-4-t4ZBqPFKv3@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).