From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 622 invoked by alias); 21 Nov 2013 05:32:55 -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 564 invoked by uid 48); 21 Nov 2013 05:32:49 -0000 From: "luto at mit dot edu" 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 05:32: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: luto at mit dot edu 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: 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/msg00219.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=16197 --- Comment #2 from Andy Lutomirski --- I suspect that glibc's code is fine, insofar programs using it aren't invoking undefined behavior. That being said, I'm not sure I can blame gcc for warning. glibc is doing something roughly equivalent to: struct foo { unsigned char array[10]; }; void func(struct foo *foo) { int x = *(int*)foo->array; } There's no actual aliasing violation there (the object is of type int, not char), but the code sure *looks* like an aliasing violation. Given that the other variant is already there in bits/socket.h, it seems to me that glibc should just switch to using it and eliminate the warning. -- You are receiving this mail because: You are on the CC list for the bug.