From f90aa28162a840dd0b843a0fbb8d32fa2da7128d Mon Sep 17 00:00:00 2001 From: jmcmullan Date: Thu, 23 Jan 2014 21:58:09 +0000 Subject: [PATCH] unix/eth.device: Fix some -O3 strict-aliasing issues C99 says we can use 'char *' to get around this. Signed-off-by: Jason S. McMullan git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@48768 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- arch/all-unix/devs/networks/eth/command.c | 5 +++-- arch/all-unix/devs/networks/eth/iotask.c | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/arch/all-unix/devs/networks/eth/command.c b/arch/all-unix/devs/networks/eth/command.c index 01ffebed84..6b7da80201 100644 --- a/arch/all-unix/devs/networks/eth/command.c +++ b/arch/all-unix/devs/networks/eth/command.c @@ -236,8 +236,9 @@ static BOOL eth_get_global_stats(struct IOSana2Req *req, struct eth_unit *unit) static BOOL eth_broadcast(struct IOSana2Req *req, struct eth_unit *unit) { /* just fill in the broadcast address as the dest, and write as normal */ - *((ULONG *) req->ios2_DstAddr) = 0xffffffff; - *((UWORD *) (req->ios2_DstAddr + 4)) = 0xffff; + char *addr = req->ios2_DstAddr; + *((ULONG *) addr) = 0xffffffff; + *((UWORD *) (addr + 4)) = 0xffff; return eth_write(req, unit); } diff --git a/arch/all-unix/devs/networks/eth/iotask.c b/arch/all-unix/devs/networks/eth/iotask.c index 3822fbc596..e80fae1845 100644 --- a/arch/all-unix/devs/networks/eth/iotask.c +++ b/arch/all-unix/devs/networks/eth/iotask.c @@ -19,6 +19,7 @@ static void eth_receive(struct eth_base *ETHBase, struct eth_unit *unit) unsigned char buf[ETH_FRAME_LEN], *packet; int nread, ioerr; struct ethhdr *eth; + char *dest; WORD packet_type; struct eth_opener *opener, *opener_next; struct IOSana2Req *req, *req_next; @@ -56,8 +57,9 @@ static void eth_receive(struct eth_base *ETHBase, struct eth_unit *unit) D(bug("[eth] [io:%d] packet type: 0x%04x\n", unit->num, packet_type)); /* broadcast packets have the top 40 bits (5 bytes) set */ - if ((*((ULONG *) (eth->h_dest)) == 0xffffffff) && - (*((UWORD *) (eth->h_dest + 4)) == 0xffff)) { + dest = eth->h_dest; + if ((*((ULONG *) (dest)) == 0xffffffff) && + (*((UWORD *) (dest + 4)) == 0xffff)) { D(bug("[eth] [io:%d] broadcast packet\n")); bcast = TRUE; } -- 2.11.4.GIT