lwip-devel
[Top][All Lists]
Advanced

[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: Simon Goldschmidt
Subject: [lwip-devel] [bug #26273] etharp.c : fix alignment issue in etharp_raw
Date: Wed, 22 Apr 2009 16:06:10 +0000
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; de; rv:1.9.0.8) Gecko/2009032608 Firefox/3.0.8

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

> The compiler assumes all pointers to structs are properly aligned.

If the struct is inside another *packed* struct, the compiler should not
assume proper alignment but cope with any alignment!

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

Your example is the other way round: the code in question does not cast from
2-byte-aligned to 4-byte-aligned but from 4-byte-aligned to 2-byte-aligned. In
your example this would be:

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

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

Any compiler should doe that porperly! (Only our code in question is using
structs, not u8/u32_t, but I don't see why that should make a difference)

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?26273>

_______________________________________________
  Nachricht geschickt von/durch Savannah
  http://savannah.nongnu.org/





reply via email to

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