[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [lwip-devel] [PATCH] Fix aliasing violation.
From: |
bill |
Subject: |
RE: [lwip-devel] [PATCH] Fix aliasing violation. |
Date: |
Fri, 3 Oct 2008 09:39:20 -0400 |
But we should use SMEMCPY. I use a macro that converts this to a series of
inline load/stores.
Bill
> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden On
> Behalf Of David Woodhouse
> Sent: Friday, October 03, 2008 5:43 AM
> To: lwip-devel
> Subject: [lwip-devel] [PATCH] Fix aliasing violation.
>
> src/netif/etharp.c: In function ‘etharp_arp_input’:
> src/netif/etharp.c:708: warning: dereferencing type-punned pointer will
> break strict-aliasing rules
>
> Index: src/netif/etharp.c
> ===================================================================
> RCS file: /sources/lwip/lwip/src/netif/etharp.c,v
> retrieving revision 1.148
> diff -u -p -r1.148 etharp.c
> --- src/netif/etharp.c 19 Jun 2008 16:40:59 -0000 1.148
> +++ src/netif/etharp.c 3 Oct 2008 09:39:55 -0000
> @@ -705,7 +705,7 @@ etharp_arp_input(struct netif *netif, st
> hdr->opcode = htons(ARP_REPLY);
>
> hdr->dipaddr = hdr->sipaddr;
> - hdr->sipaddr = *(struct ip_addr2 *)&netif->ip_addr;
> + memcpy(&hdr->sipaddr, &netif->ip_addr, sizeof(hdr->sipaddr));
>
> LWIP_ASSERT("netif->hwaddr_len must be the same as
> ETHARP_HWADDR_LEN for etharp!",
> (netif->hwaddr_len == ETHARP_HWADDR_LEN));
>
> --
> David Woodhouse Open Source Technology
> Centre
> address@hidden Intel
> Corporation
>
>
>
> _______________________________________________
> lwip-devel mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/lwip-devel