Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

warning:dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] #18

Open
amberberchuang opened this issue Oct 15, 2019 · 0 comments

Comments

@amberberchuang
Copy link

i just got error when compiling shadowsocks
src/udprelay.c:557:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
ev_io_init(&ctx->io, server_recv_cb, fd, EV_READ);
^
src/udprelay.c:557:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
src/udprelay.c:557:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
src/udprelay.c:557:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
In file included from ./libcork/core/byte-order.h:16:0,
from ./libcork/core/hash.h:16,
from ./libcork/core/callbacks.h:14,
from ./libcork/core/allocator.h:18,
from ./libcork/core.h:15,
from src/udprelay.c:50:
src/udprelay.c: In function 'remote_timeout_cb':
./libcork/core/types.h:79:59: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith]
((struct_type *) (- offsetof(struct_type, field_name) +
^
src/udprelay.c:604:11: note: in expansion of macro 'cork_container_of'
= cork_container_of(watcher, remote_ctx_t, watcher);
^
src/udprelay.c: In function 'remote_recv_cb':
src/udprelay.c:710:32: warning: cast increases required alignment of target type [-Wcast-align]
remote_ctx_t *remote_ctx = (remote_ctx_t *)w;
^
src/udprelay.c: In function 'server_recv_cb':
src/udprelay.c:1259:17: warning: implicit declaration of function 'set_broadcast' [-Wimplicit-function-declaration]
set_broadcast(remotefd);
^
src/udprelay.c:1279:35: error: 'remote_ctx_t' has no member named 'dst_addr'
memcpy(&remote_ctx->dst_addr, &dst_addr, sizeof(struct sockaddr_storage));
^
compilation terminated due to -Wfatal-errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant