This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/16197] CMSG_DATA results in (possibly correct) string aliasing warnings on gcc


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]