public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "lavr at ncbi dot nlm.nih.gov" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/96293] Extraneously noisy "taking address of packed member may result in an unaligned pointer value" Date: Mon, 27 Jul 2020 16:08:52 +0000 [thread overview] Message-ID: <bug-96293-4-nEhMiupSG1@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-96293-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96293 --- Comment #5 from lavr at ncbi dot nlm.nih.gov --- My test case is not invalid. You're talking about base address of a structure, which would make offsets within it all unaligned, which is why I said "the same rule should apply for aggregates". So should "struct S" appear anywhere in an outer structure at an offset, which would not be its "native offset otherwise assigned by GCC, as if it wasn't packed", then there's a potential problem. Otherwise, the member addresses will still remain well-aligned, and no warnings would be ever necessary. As for your example, any structure's address can be type-cast to any value (it's C, for the sake of it), yet GCC doesn't assume that happens for non-packed structures, right? Extra warnings in large projects are disruptive, and if GCC warns about something, it should be well-warranted and verified. Applying a bit of an extra-logic (which does not take a lot of CPU cycles, or additional compilation time) for those new warnings, and not issuing them just mechanically, would help a lot.
next prev parent reply other threads:[~2020-07-27 16:08 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-07-23 0:23 [Bug c/96293] New: " lavr at ncbi dot nlm.nih.gov 2020-07-23 6:02 ` [Bug c/96293] " rguenth at gcc dot gnu.org 2020-07-23 14:59 ` lavr at ncbi dot nlm.nih.gov 2020-07-23 15:01 ` lavr at ncbi dot nlm.nih.gov 2020-07-27 11:15 ` jakub at gcc dot gnu.org 2020-07-27 16:08 ` lavr at ncbi dot nlm.nih.gov [this message] 2022-07-06 10:05 ` ldeng at mail dot ustc.edu.cn 2022-07-06 14:05 ` lavr at ncbi dot nlm.nih.gov 2022-07-06 15:15 ` lavr at ncbi dot nlm.nih.gov 2022-07-07 8:23 ` ldeng at mail dot ustc.edu.cn 2022-07-07 13:13 ` lavr at ncbi dot nlm.nih.gov
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-96293-4-nEhMiupSG1@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).