[cfe-dev] A problem about builtin-type creation

peterlee peterlee at cs.utah.edu
Tue Aug 5 10:11:22 PDT 2014


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:

/home/xxx/vendor/llvm-3.3/build32/Release+Asserts/../../include/llvm/ADT/PointerIntPair.h:100: 
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!

Thanks
Peng



More information about the cfe-dev mailing list