|
From: | Timmy Brolin |
Subject: | Re: [lwip-users] [PATCH] fix warning for gcc and possible unaligned access |
Date: | Wed, 19 Apr 2006 18:55:06 +0200 |
User-agent: | Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) |
Pedro Alves wrote:
address@hidden wrote:Hi, Why not just replace the lines *(struct ip_addr2 *)&sipaddr = hdr->sipaddr; *(struct ip_addr2 *)&dipaddr = hdr->dipaddr; with sipaddr = *(struct ip_addr *)&hdr->sipaddr; dipaddr = *(struct ip_addr *)&hdr->dipaddr;Because if hdr->sipaddr is unaligned and the architecture doesn't support unaligned accesses, like many RISCs do, the result is undefined.
Are you sure that it can become unaligned? There is code in place in lwip to guarantee header alignment...
[Prev in Thread] | Current Thread | [Next in Thread] |