http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56018
Bug #: 56018 Summary: Access to member of unnamed union variable in structure Classification: Unclassified Product: gcc Version: 4.4.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: stephan...@gmail.com Created attachment 29190 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29190 ngx_event preprocessed file, where __sigaction_handler automaticaly added When accessing from structure to unnamed union variable, it's union variable name automatically added to preprocessed code, without check if it was added in source. In nginx(1.3.7, ngx_event.c) there code like: struct sigaction sa; sa.sa_handler = ngx_timer_signal_handler; From preprocessor file I got, that sigaction has next difinition: # 25 "/usr/include/bits/sigaction.h" 3 4 struct sigaction { union { __sighandler_t sa_handler; void (*sa_sigaction) (int, siginfo_t *, void *); } __sigaction_handler; __sigset_t sa_mask; int sa_flags; void (*sa_restorer) (void); }; So when I find the lines above I saw that while accessing the union variable member, it's name was added(ngx_event.i:13893): sa.__sigaction_handler.sa_handler = ngx_timer_signal_handler; When I changed source code to: sa.__sigaction_handler.sa_handler = ngx_timer_signal_handler; the preprocessor file of it became: sa.__sigaction_handler.__sigaction_handler.sa_handler = ngx_timer_signal_handler; and I got an error: gcc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \ -o objs/src/event/ngx_event.o \ src/event/ngx_event.c gcc-4.4: warning: -pipe ignored because -save-temps specified src/event/ngx_event.c: In function ‘ngx_event_process_init’: src/event/ngx_event.c:644: error: ‘union <anonymous>’ has no member named ‘__sigaction_handler’ make[1]: *** [objs/src/event/ngx_event.o] Error 1 make[1]: Leaving directory `/root/newM/nginx-1.3.7' make: *** [build] Error 2