public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
From: "bugdal at aerifal dot cx" <sourceware-bugzilla@sourceware.org> To: glibc-bugs@sourceware.org Subject: [Bug libc/16197] CMSG_DATA results in (possibly correct) string aliasing warnings on gcc Date: Thu, 21 Nov 2013 00:26:00 -0000 [thread overview] Message-ID: <bug-16197-131-h0oZrPJbTL@http.sourceware.org/bugzilla/> (raw) In-Reply-To: <bug-16197-131@http.sourceware.org/bugzilla/> https://sourceware.org/bugzilla/show_bug.cgi?id=16197 Rich Felker <bugdal at aerifal dot cx> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugdal at aerifal dot cx --- Comment #1 from Rich Felker <bugdal at aerifal dot cx> --- This is actually a complicated issue and unfortunately I think GCC is stuck in the middle of an inconsistency in the standard. Per the standard, it's legal to step around the representation of an object (an overlaid char-type array) using offsets (e.g. obtained from offsetof()) and char pointers. For example, this would *clearly* be valid: *(T *)((char *)pmsg + offsetof(struct cmsghdr, __cmsg_data) + N) (assuming there's an object of type T at offset N from the end of the message header, which is plausible if pmsg points to storage obtained by malloc). But (char *)pmsg + offsetof(struct cmsghdr, __cmsg_data) evaluates to the same thing as pmsg->__cmsg_data (after array decay). So it's not clear how the former can be valid and the latter an aliasing violation. -- You are receiving this mail because: You are on the CC list for the bug.
next prev parent reply other threads:[~2013-11-21 0:26 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-11-20 21:31 [Bug libc/16197] New: " luto at mit dot edu 2013-11-21 0:26 ` bugdal at aerifal dot cx [this message] 2013-11-21 5:32 ` [Bug libc/16197] " luto at mit dot edu 2013-12-02 6:45 ` crrodriguez at opensuse dot org 2014-06-13 11:59 ` fweimer at redhat dot com 2015-08-27 22:18 ` [Bug network/16197] " jsm28 at gcc dot gnu.org
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-16197-131-h0oZrPJbTL@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=glibc-bugs@sourceware.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).