https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67246

Thomas Martitz <kugel at rockbox dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |---

--- Comment #6 from Thomas Martitz <kugel at rockbox dot org> ---
Sorry to annoy you with re-open it's not fully resolved for me.

You proposed solution of specifying a different alignment has no effect.

struct iphdr {
#if defined(__LITTLE_ENDIAN_BITFIELD)
        __u8    ihl:4,
                version:4;
#elif defined (__BIG_ENDIAN_BITFIELD)
        __u8    version:4,
                ihl:4;
#else
#error  "Please fix <asm/byteorder.h>"
#endif
        __u8    tos;
        __be16  tot_len;
        __be16  id;
        __be16  frag_off;
        __u8    ttl;
        __u8    protocol;
        __sum16 check;
        __be32  saddr;
        __be32  daddr;
        /*The options start here. */
} __attribute((aligned(2)));

Generated code:
                nhoff += iph->ihl * 4;
 248:   8e220000        lw      v0,0(s1)
 24c:   8fa40044        lw      a0,68(sp)
 250:   7c421e00        ext     v0,v0,0x18,0x4
 254:   00021080        sll     v0,v0,0x2
 258:   00821021        addu    v0,a0,v0

I understand you that this should work?

Reply via email to