Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
openSUSE:Leap:42.2:Ports
libibverbs
libibverbs-fix_aliasing.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File libibverbs-fix_aliasing.patch of Package libibverbs
From: Jan Engelhardt <jengelh@inai.de> Date: 2012-08-26 21:34:11.356459793 +0200 src: fix breakage of alignment constraints and strict aliasing src/verbs.c: In function 'is_link_local_gid': src/verbs.c:689:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] src/verbs.c:690:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] examples/pingpong.c: In function 'wire_gid_to_gid': examples/pingpong.c:76:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] examples/pingpong.c: In function 'gid_to_wire_gid': examples/pingpong.c:85:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] --- examples/pingpong.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) Index: examples/pingpong.c =================================================================== --- examples/pingpong.c.orig 2014-01-17 17:56:03.555235512 +0100 +++ examples/pingpong.c 2014-01-17 18:00:03.448680268 +0100 @@ -67,21 +67,24 @@ int pp_get_port_info(struct ibv_context void wire_gid_to_gid(const char *wgid, union ibv_gid *gid) { char tmp[9]; - uint32_t v32; + uint32_t v32, v32n; int i; for (tmp[8] = 0, i = 0; i < 4; ++i) { memcpy(tmp, wgid + i * 8, 8); sscanf(tmp, "%x", &v32); - *(uint32_t *)(&gid->raw[i * 4]) = ntohl(v32); + v32n = ntohl(v32); + memcpy(&gid->raw[i*4], &v32n, sizeof(v32n)); } } void gid_to_wire_gid(const union ibv_gid *gid, char wgid[]) { int i; + uint32_t v32; - for (i = 0; i < 4; ++i) - sprintf(&wgid[i * 8], "%08x", - htonl(*(uint32_t *)(gid->raw + i * 4))); + for (i = 0; i < 4; ++i) { + memcpy(&v32, gid->raw + i * 4, sizeof(v32)); + sprintf(&wgid[i * 8], "%08x", htonl(v32)); + } }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor