Subject: Re: Data Abort Exceptions
To: Jay Monkman <jtm@smoothsmoothie.com>
From: Ben Harris <bjh21@netbsd.org>
List: port-arm
Date: 07/22/2002 23:09:39
On Mon, 22 Jul 2002, Jay Monkman wrote:

> How can this work? What if someone wants to compile an application
> something like the following:
>         typedef struct {
>              char c  __attribute__ ((packed));
>              long l  __attribute__ ((packed));
>         } foo_t;
>
>
>         void func1(void);
>         void func2(long *p);
>
>         void func1(void)
>         {
>              foo_t foo;
>
>              foo.c = 'a';
>              foo.l = 0x12345678;
>
>              func2(&foo.l);

I think GCC should issue a warning here.  You're implicitly converting
from one pointer type to another with stricter alignment constraints
(actually not stricter so much as utterly incompatible here), which is
often a mistake.

-- 
Ben Harris                                                   <bjh21@netbsd.org>
Portmaster, NetBSD/acorn26           <URL:http://www.netbsd.org/Ports/acorn26/>