PR 1098: "struct ipovly" notpacked.

ray xr at trasin.net
Tue Jul 11 13:27:21 UTC 2006


In fact, the PR works for the ARM board.
And the __attribute__((packed)) do really convert the 32bit load/store instruction to 2 16bit load/store instruction(or 4 8bit load/store).
The struct may seems well format, but after packing and copying, the head point of tcpiphdr is not 32bit aligned, which may cause data access abort. And in the new version of BSD, the mal-aligned members (ti_next, ti_prev) have gone.


Thanks & Best Regards !
------------------
ray
2006-07-11

-------------------------------------------------------------
from£ºRalf Corsepius
Date£º2006-07-11 20:07:59
to£ºDenny.Bai
CC£ºJay Monkman; Chris Johns; RTEMS Users
Subject£ºRe: PR 1098: "struct ipovly" notpacked.

On Thu, 2006-07-06 at 21:22 -0400, Denny.Bai wrote:
> typedef struct {
>    long  l1;
>    short s1;
>    long  l2;
> } s2_t __attribute__((packed));  /* does nothing */
>
> --------------------------------------------------
>
> if above code changed like this, "__attribute__((packed))" will work
> and the warning will not appear again.
>
> typedef struct {
>    long  l1;
>    short s1;
>    long  l2;
> }__attribute__((packed)) s2_t;

structs like the ones above are BAD DESIGN.

With or without __attribute((packed))__ there is no guarantee they will
work. If you have a look into the BSD structures we are talking about
here, they are designed in such a way that "packing" should not have any
effect.

Ralf









More information about the users mailing list