[Top][All Lists]

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

[lwip-devel] [bug #26273] etharp.c : fix alignment issue in etharp_raw

From: Bill Auerbach
Subject: [lwip-devel] [bug #26273] etharp.c : fix alignment issue in etharp_raw
Date: Wed, 22 Apr 2009 13:50:41 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/2009032609 Firefox/3.0.8

Follow-up Comment #6, bug #26273 (project lwip):

(Posted to lwip-devel - including it here now)

The compiler assumes all pointers to structs are properly aligned.  All
local, static, and global struct allocations are going to be properly aligned.
 They would not be aligned when casting to pointers to those structs.  Hence,
pointer casting isn't portable or guaranteed to always work.

It would be curious to see how it is handled if a union were used and the
casting removed.  I expect then with padding turned off that the compiler
might do the right thing.


I disagree that what you're seeing is a compiler bug.

For example:

u8_t buffer[10];
u32_t *ptr, i;

ptr = (u32_t *) &buffer[1];
i = *ptr;

This will fail in the same way.  It's an implicit copy of a u32_t - but it's
not a compiler bug.



Reply to this item at:


  Message sent via/by Savannah

reply via email to

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