[cfe-dev] A problem about builtin-type creation
rnk at google.com
Tue Aug 5 10:48:48 PDT 2014
It is asserting that the Type pointer is not 16 byte aligned. Types are
generally constructed and uniqued in an ASTContext, which guarantees this
alignment. See this at the top of Type.h:
TypeAlignmentInBits = 4,
TypeAlignment = 1 << TypeAlignmentInBits
Presumably you are building 32-bit code, where the system malloc returns 8
byte aligned chunks.
On Tue, Aug 5, 2014 at 10:11 AM, peterlee <peterlee at cs.utah.edu> wrote:
> Dear All,
> I am using Clang/LLVM-3.3, at present, I am fixing an error about creating
> a builtin type, the code is supposed to
> generate a "boolean" type with the following code:
> clang::Type* bool_type = new clang::BuiltinType(clang::BuiltinType::Bool);
> params.push_back(klimt::NamedDecl(clang::QualType(bool_type, 0), pname));
> I always encountered the error:
> void llvm::PointerIntPair<PointerTy, IntBits, IntType,
> PtrTraits>::initWithPointer(PointerTy) [with PointerTy = void*; unsigned
> int IntBits = 1u; IntType = bool; PtrTraits = llvm::PointerUnionUIntTraits<const
> clang::Type*, const clang::ExtQuals*>]: Assertion `(PtrWord & ((1 <<
> PtrTraits::NumLowBitsAvailable)-1)) == 0 && "Pointer is not sufficiently
> aligned"' failed
> The assertion fails at the BuiltinType creation.
> Any thoughts about how to fix this error is highly appreciated!
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev