[LLVMbugs] [Bug 12612] New: Assertion raised: Pointer is not sufficiently aligned in PointerIntPair::setPointer
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sat Apr 21 08:50:44 PDT 2012
http://llvm.org/bugs/show_bug.cgi?id=12612
Bug #: 12612
Summary: Assertion raised: Pointer is not sufficiently aligned
in PointerIntPair::setPointer
Product: libraries
Version: trunk
Platform: PC
OS/Version: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Support Libraries
AssignedTo: unassignedbugs at nondot.org
ReportedBy: wuye9036 at gmail.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Hi guys,
When I am compiling a code as following
void set(i32* ret, i32 v)
store i32 v, i32* ret
Following assertion was raised:
Assertion failed: (PtrVal % (1 << PtrTraits::NumLowBitsAvailable) == 0) &&
"Poin
ter is not sufficiently aligned", file
D:\Programming\salvia\3rd_party\llvm\incl
ude\llvm/ADT/PointerIntPair.h, line 79
I've trace into code,
void setPointer(PointerTy Ptr) {
intptr_t PtrVal
= reinterpret_cast<intptr_t>(PtrTraits::getAsVoidPointer(Ptr));
assert( (PtrVal & (1 << PtrTraits::NumLowBitsAvailable)-1) == 0) &&
"Pointer is not sufficiently aligned");
// Preserve all low bits, just update the pointer.
Value = PtrVal | (Value & ~PointerBitMask);
}
And now PointerTy is IndexListEntry, and PtrVal is address of object.
In PtrTraits, NumLowBitAvailable is 3 when type is IndexListEntry. So
assertion need PtrVal is 8-byte aligned.
But when entry is creating, the alignOf<IndexListEntry>() is 4.
IndexListEntry *entry =
static_cast<IndexListEntry*>(
ileAllocator.Allocate(sizeof(IndexListEntry),
alignOf<IndexListEntry>()));
I think that's the reason why this assertion is raised.
Thank you.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list