From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22166 invoked by alias); 21 Nov 2013 00:26:16 -0000 Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org Received: (qmail 22131 invoked by uid 48); 21 Nov 2013 00:26:13 -0000 From: "bugdal at aerifal dot cx" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: libc X-Bugzilla-Version: 2.17 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: bugdal at aerifal dot cx X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-11/txt/msg00218.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=16197 Rich Felker changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugdal at aerifal dot cx --- Comment #1 from Rich Felker --- 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.