http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47418

Xavier <chantry.xavier at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |chantry.xavier at gmail dot
                   |                            |com

--- Comment #2 from Xavier <chantry.xavier at gmail dot com> 2011-01-23 
02:02:18 UTC ---
(In reply to comment #1)
> Also of note is the commented bit in the test case- if you instead dereference
> the s6_addr bit of the union, it all works without warnings.
> 
> In the preprocessed source, replace
>   ap = (char *)&u.sin6.sin6_addr;
> 
> with:
>   ap = (char *)&u.sin6.sin6_addr.__in6_u.__u6_addr8;

Actually it works with any member from __in6.u union.

It seems gcc gets confused with the other anonymous union, and use the size of
struct sockaddr instead of struct sockaddr_in6.

I've got a simpler testcase which shows another interesting information : gcc
gets confused when the sign of ap is the same as the size of the smallest
struct/array of the union, and different from the sign of the big member that
should be used.

Reply via email to