strict-aliasing error with gcc44 -O2
mdounin at mdounin.ru
Fri Dec 11 15:51:38 MSK 2009
I see the following error when compiling nginx 0.8.29 with gcc44
gcc44 -c -O -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Wunused-function -Wunused-variable -Wunused-value -Werror -g -O2 -I src/core -I src/event -I src/event/modules -I src/os/unix -I /usr/local/include -I objs -I src/http -I src/http/modules -o objs/src/http/ngx_http_core_module.o src/http/ngx_http_core_module.c
cc1: warnings being treated as errors
src/http/ngx_http_core_module.c: In function 'ngx_http_core_merge_srv_conf':
src/http/ngx_http_core_module.c:2859: error: dereferencing pointer 'sin' does break strict-aliasing rules
src/http/ngx_http_core_module.c:2853: error: dereferencing pointer 'sin' does break strict-aliasing rules
src/http/ngx_http_core_module.c:2857: error: dereferencing pointer 'sin' does break strict-aliasing rules
src/http/ngx_http_core_module.c:2851: note: initialized from here
*** Error code 1
gcc44 is most recent one from FreeBSD ports:
$ gcc44 --version
gcc44 (GCC) 4.4.3 20091201 (prerelease)
Other gcc versions I have compile it cleanly (4.2, 4.3 and 4.5),
and quick look at the code in question suggests that it's gcc44
error as aliasing happens with u_char data and should be allowed.
I haven't yet checked it deeply though.
Is anybody already looked at it? It's not really high priority,
but probably worth fixing even if it's gcc44 problem (at least if
not requires to much dances).
More information about the nginx-devel