[PATCH] Fix logic for big endian int<->ptr coercion
James Molloy
james at jamesmolloy.co.uk
Wed May 7 07:45:46 PDT 2014
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140507/20706fb3/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-When-doing-int-ptr-coercion-for-big-endian-calculate.patch
Type: text/x-patch
Size: 2271 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140507/20706fb3/attachment.bin>
More information about the cfe-commits
mailing list