[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
PR 1098: "struct ipovly" notpacked.
- Date: Tue, 11 Jul 2006 21:27:21 +0800
- From: xr at trasin.net (ray)
- Subject: PR 1098: "struct ipovly" notpacked.
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