This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/16197] CMSG_DATA results in (possibly correct) string aliasing warnings on gcc
- From: "luto at mit dot edu" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Thu, 21 Nov 2013 05:32:49 +0000
- Subject: [Bug libc/16197] CMSG_DATA results in (possibly correct) string aliasing warnings on gcc
- Auto-submitted: auto-generated
- References: <bug-16197-131 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=16197
--- Comment #2 from Andy Lutomirski <luto at mit dot edu> ---
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.