Skip to content

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

@amberberchuang

Description

@amberberchuang

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions