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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Hmm, the allocator Allocator__calloc is not returning the "correct" alignment
pointer for the type used here.


   0x0042a534 <+152>:   bl      0x405b74 <Allocator__calloc>
   0x0042a538 <+156>:   vldr    d16, [sp, #16]
   0x0042a53c <+160>:   vldr    d17, [sp, #24]
   0x0042a540 <+164>:   vrev64.8        q8, q8
   0x0042a544 <+168>:   mov     r4, r0
   0x0042a548 <+172>:   mov     r0, r5
   0x0042a54c <+176>:   vst1.64 {d16-d17}, [r4 :64]


r4 here is from the allocator.
And if I read this correctly, then Allocator__calloc is incorrect.


    struct Prefix6* out = Allocator__calloc((alloc),(sizeof(struct
Prefix6)),(1),"RouteGen.c",161);
    out->highBits =
((uint64_t)__builtin_bswap64(((uint64_t)(longs.highBits_be))));
    out->lowBits =
((uint64_t)__builtin_bswap64(((uint64_t)(longs.lowBits_be))));
    int pfx = Sockaddr_getPrefix(sa);

So it is doing a store into out (the high and low bits fields).

So this memory needs to be 8 byte aligned as the alignment of struct Prefix6 is
8 bytes due to the uint64_t.

So this is invalid.

Reply via email to