[PATCH] Fix logic for big endian int<->ptr coercion

Aaron Ballman aaron at aaronballman.com
Wed May 7 08:36:34 PDT 2014


LGTM! But this is far enough outside of my area of expertise, you may
want to wait for a second confirmation.

~Aaron

On Wed, May 7, 2014 at 10:45 AM, James Molloy <james at jamesmolloy.co.uk> wrote:
> Hi,
>
> When doing int<->ptr coercion for big-endian architectures, the shift amount
> is currently incorrectly calculated.
>
> The shift amount is based upon DataLayout::getTypeAllocSizeInBits. This will
> only work for legal types - types such as i24 that are created as part of
> structs for bitfields will return "32" from that function. This patch
> changes to using getTypeSizeInBits.
>
> It turns out that AArch64 didn't run across this problem because it always
> returned [1 x i64] as the type for a bitfield, whereas ARM64 returns i64 so
> goes down this (better, but wrong) codepath.
>
> I'm almost certain this change is good, but as I'm not a clang expert and
> this is generic (big-endian only though) code, I'd appreciate if someone
> else would also give it the once-over.
>
> Cheers,
>
> James
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>



More information about the cfe-commits mailing list