lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [lwip-users] [PATCH] fix warning for gcc and possible unaligned acce


From: Curt McDowell
Subject: RE: [lwip-users] [PATCH] fix warning for gcc and possible unaligned access
Date: Tue, 25 Apr 2006 11:09:28 -0700

More observations about structure packing:

In gcc, it seems the __attribute__((packed)) is inherited by all
sub-structures.  But in armcc, the compiler disallows normal structures from
being members of __packed structures.  So simply making 'struct ipaddr'
unpacked isn't going to work for all compilers.  Maybe there should be a packed
and unpacked version of struct ipaddr, so that the compiler doesn't have to
generate unaligned support code everywhere struct ipaddr is used.

I think Pedro is right and just about any compiler that supports packed
structures must support assigning, referencing or copying unaligned uint32
members.  ip_addr2 first came into use in etharp.c:1.55 on 04/27/04 to fix bug
#8708.  Leon or Timmy, do you happen to remember which was the offending
compiler that couldn't generate the right code for this case?  Or was the code
really doing something illegal like *(uint32 *)&ipaddr?

Regards,
Curt McDowell
Broadcom Corp.







reply via email to

[Prev in Thread] Current Thread [Next in Thread]