This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [3.3 PATCH RFA]: Patch for packed structures on 3.3 branch (PR middle-end/16038)


You Wrote Ian Lance Taylor
> This test case fails for the mips-elf target on 3.3 with -O:
>
> struct in_addr {
>   unsigned int s_addr;
> } __attribute__((__packed__));
> struct MemberInfo_t {
>     char membername[1];
>     struct in_addr ipaddrs[3];
> };
> extern void bar (struct in_addr);
> void foo(struct MemberInfo_t *p)
> {
>   unsigned int i;
>   for (i = 0; i < 3; i++)
>     if (p->ipaddrs[i].s_addr != 0)
>       bar(p->ipaddrs[i]);
> }
>
> It generates an illegal unaligned access.  See PR middle-end/16038 for
> the details.
>
> The code works in 3.4.  This patch fixes the problem in 3.3.
>
> OK for the 3.3 branch for inclusion in 3.3.5?

Yes.  Thanks.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]