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

James Molloy james at jamesmolloy.co.uk
Wed May 7 10:49:16 PDT 2014


Hi,

Thanks Aaron! Joey also looked at it on IRC and noticed that the testcase
would fail in release mode. I've fixed that and committed in r208231.

Cheers,

James


On 7 May 2014 16:36, Aaron Ballman <aaron at aaronballman.com> wrote:

> 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
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140507/01950459/attachment.html>


More information about the cfe-commits mailing list