<div dir="ltr">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:<div><div>  enum {<br>
</div><div>    TypeAlignmentInBits = 4,</div><div>    TypeAlignment = 1 << TypeAlignmentInBits</div><div>  };</div><div><br></div><div>Presumably you are building 32-bit code, where the system malloc returns 8 byte aligned chunks.</div>
</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Aug 5, 2014 at 10:11 AM, peterlee <span dir="ltr"><<a href="mailto:peterlee@cs.utah.edu" target="_blank">peterlee@cs.utah.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear All,<br>
<br>
I am using Clang/LLVM-3.3, at present, I am fixing an error about creating a builtin type, the code is supposed to<br>
generate a "boolean" type with the following code:<br>
<br>
clang::Type* bool_type = new clang::BuiltinType(clang::<u></u>BuiltinType::Bool);<br>
params.push_back(klimt::<u></u>NamedDecl(clang::QualType(<u></u>bool_type, 0), pname));<br>
<br>
I always encountered the error:<br>
<br>
/home/xxx/vendor/llvm-3.3/<u></u>build32/Release+Asserts/../../<u></u>include/llvm/ADT/<u></u>PointerIntPair.h:100: void llvm::PointerIntPair<<u></u>PointerTy, IntBits, IntType, PtrTraits>::initWithPointer(<u></u>PointerTy) [with PointerTy = void*; unsigned int IntBits = 1u; IntType = bool; PtrTraits = llvm::PointerUnionUIntTraits<<u></u>const clang::Type*, const clang::ExtQuals*>]: Assertion `(PtrWord & ((1 << PtrTraits::<u></u>NumLowBitsAvailable)-1)) == 0 && "Pointer is not sufficiently aligned"' failed<br>

<br>
The assertion fails at the BuiltinType creation.<br>
<br>
Any thoughts about how to fix this error is highly appreciated!<br>
<br>
Thanks<br>
Peng<br>
______________________________<u></u>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br></div>