<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Some more data.<div><br></div><div>I upgraded to todays llvm/clang/clang-extra-tools top-of-trunk and I upgraded my compiler to deal with all of the changes in llvm/clang since last September.</div><div>My current ToT llvm commit is 4b678bff4ebae28ec7e04ec936cf924ee8d289df</div><div><br></div><div>I am still getting an assertion failure at exactly the same point, when I’m calling DIBuilder::finalize but the assertion has changed (but similar)- it is now:</div><div><div>Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"), function cast, file /Users/meister/Development/externals-clasp/llvm36/include/llvm/Support/Casting.h, line 237.</div></div><div><br></div><div>Below is some info that may answer your (Duncan and Frederic) questions:</div><div><br></div><div>1) Duncan asked “are you using two different `LLVMContext`s?”</div><div>Answer: I may be - in frame 6 the DbgNode->Context reference looks mangled</div><div><br></div><div>2) Frederic asked “is TempEnumTypes null at this point”</div><div>Answer: No, it has the value<font face="Arial"> 0x000000011c81fda8</font></div><div><font face="Arial"><br></font></div><div><font face="Arial">Below is an lldb session where I’m looking at the backtrace.</font></div><div><br></div><div><div><font face="Courier New">(lldb) up</font></div><div><font face="Courier New">frame #4: 0x0000000103de1811 clasp_boehm_d`__assert_rtn(func=0x00000001043a5749, file=0x00000001043a574e, line=237, expr=0x00000001043a579f) + 129 at Signals.inc:533</font></div><div><font face="Courier New"> 530 <span class="Apple-tab-span" style="white-space:pre"> </span> else</font></div><div><font face="Courier New"> 531 <span class="Apple-tab-span" style="white-space:pre"> </span> fprintf(stderr, "Assertion failed: (%s), file %s, line %d.\n",</font></div><div><font face="Courier New"> 532 <span class="Apple-tab-span" style="white-space:pre"> </span> expr, file, line);</font></div><div><font face="Courier New">-> 533 <span class="Apple-tab-span" style="white-space:pre"> </span> abort();</font></div><div><font face="Courier New"> 534 <span class="Apple-tab-span" style="white-space:pre"> </span>}</font></div><div><font face="Courier New"> 535 <span class="Apple-tab-span" style="white-space:pre"> </span></font></div><div><font face="Courier New"> 536 <span class="Apple-tab-span" style="white-space:pre"> </span>void abort() {</font></div><div><span style="font-family: 'Courier New';">(lldb) up</span></div><div><font face="Courier New">frame #5: 0x0000000103cf47dc clasp_boehm_d`llvm::cast_retty<llvm::MDNodeFwdDecl, llvm::MDNode*>::ret_type llvm::cast<llvm::MDNodeFwdDecl, llvm::MDNode>(Val=0x000000011c81fda8) + 108 at Casting.h:237</font></div><div><font face="Courier New"> 234 <span class="Apple-tab-span" style="white-space:pre"> </span></font></div><div><font face="Courier New"> 235 <span class="Apple-tab-span" style="white-space:pre"> </span>template <class X, class Y></font></div><div><font face="Courier New"> 236 <span class="Apple-tab-span" style="white-space:pre"> </span>inline typename cast_retty<X, Y *>::ret_type cast(Y *Val) {</font></div><div><font face="Courier New">-> 237 <span class="Apple-tab-span" style="white-space:pre"> </span> assert(isa<X>(Val) && "cast<Ty>() argument of incompatible type!");</font></div><div><font face="Courier New"> 238 <span class="Apple-tab-span" style="white-space:pre"> </span> return cast_convert_val<X, Y*,</font></div><div><font face="Courier New"> 239 <span class="Apple-tab-span" style="white-space:pre"> </span> typename simplify_type<Y*>::SimpleType>::doit(Val);</font></div><div><font face="Courier New"> 240 <span class="Apple-tab-span" style="white-space:pre"> </span>}</font></div><div><div><span style="font-family: 'Courier New';">(lldb) up</span></div></div><div><font face="Courier New">frame #6: 0x0000000103b6bf6a clasp_boehm_d`llvm::DIDescriptor::replaceAllUsesWith(this=0x00007fff5fbdba18, D=0x0000000109d24380) + 218 at DebugInfo.cpp:349</font></div><div><font face="Courier New"> 346 <span class="Apple-tab-span" style="white-space:pre"> </span>void DIDescriptor::replaceAllUsesWith(MDNode *D) {</font></div><div><font face="Courier New"> 347 <span class="Apple-tab-span" style="white-space:pre"> </span> assert(DbgNode && "Trying to replace an unverified type!");</font></div><div><font face="Courier New"> 348 <span class="Apple-tab-span" style="white-space:pre"> </span> assert(DbgNode != D && "This replacement should always happen");</font></div><div><font face="Courier New">-> 349 <span class="Apple-tab-span" style="white-space:pre"> </span> auto *Node = cast<MDNodeFwdDecl>(const_cast<MDNode *>(DbgNode));</font></div><div><font face="Courier New"> 350 <span class="Apple-tab-span" style="white-space:pre"> </span> Node->replaceAllUsesWith(D);</font></div><div><font face="Courier New"> 351 <span class="Apple-tab-span" style="white-space:pre"> </span> MDNode::deleteTemporary(Node);</font></div><div><font face="Courier New"> 352 <span class="Apple-tab-span" style="white-space:pre"> </span>}</font></div><div><font face="Courier New">(lldb) up</font></div><div><font face="Courier New">frame #7: 0x0000000103b4ff19 clasp_boehm_d`llvm::DIBuilder::finalize(this=0x000000011c81feb0) + 185 at DIBuilder.cpp:74</font></div><div><font face="Courier New"> 71 <span class="Apple-tab-span" style="white-space:pre"> </span></font></div><div><font face="Courier New"> 72 <span class="Apple-tab-span" style="white-space:pre"> </span>void DIBuilder::finalize() {</font></div><div><font face="Courier New"> 73 <span class="Apple-tab-span" style="white-space:pre"> </span> DIArray Enums = getOrCreateArray(AllEnumTypes);</font></div><div><font face="Courier New">-> 74 <span class="Apple-tab-span" style="white-space:pre"> </span> DIType(TempEnumTypes).replaceAllUsesWith(Enums);</font></div><div><font face="Courier New"> 75 <span class="Apple-tab-span" style="white-space:pre"> </span></font></div><div><font face="Courier New"> 76 <span class="Apple-tab-span" style="white-space:pre"> </span> SmallVector<Metadata *, 16> RetainValues;</font></div><div><font face="Courier New"> 77 <span class="Apple-tab-span" style="white-space:pre"> </span> // Declarations and definitions of the same type may be retained. Some</font></div><div><font face="Courier New">(lldb) print TempEnumTypes</font></div><div><font face="Courier New">(llvm::MDNode *) $0 = 0x000000011c81fda8</font></div></div><div><font face="Courier New">;;; Later on</font></div><div><div><font face="Courier">(lldb) down</font></div><div><font face="Courier">frame #6: 0x0000000103b6bf6a clasp_boehm_d`llvm::DIDescriptor::replaceAllUsesWith(this=0x00007fff5fbdba18, D=0x0000000109d24380) + 218 at DebugInfo.cpp:349</font></div><div><font face="Courier"> 346 <span class="Apple-tab-span" style="white-space:pre"> </span>void DIDescriptor::replaceAllUsesWith(MDNode *D) {</font></div><div><font face="Courier"> 347 <span class="Apple-tab-span" style="white-space:pre"> </span> assert(DbgNode && "Trying to replace an unverified type!");</font></div><div><font face="Courier"> 348 <span class="Apple-tab-span" style="white-space:pre"> </span> assert(DbgNode != D && "This replacement should always happen");</font></div><div><font face="Courier">-> 349 <span class="Apple-tab-span" style="white-space:pre"> </span> auto *Node = cast<MDNodeFwdDecl>(const_cast<MDNode *>(DbgNode));</font></div><div><font face="Courier"> 350 <span class="Apple-tab-span" style="white-space:pre"> </span> Node->replaceAllUsesWith(D);</font></div><div><font face="Courier"> 351 <span class="Apple-tab-span" style="white-space:pre"> </span> MDNode::deleteTemporary(Node);</font></div><div><font face="Courier"> 352 <span class="Apple-tab-span" style="white-space:pre"> </span>}</font></div><div><font face="Courier">(lldb) print DbgNode</font></div><div><font face="Courier">(const llvm::MDNode *) $1 = 0x000000011c81fda8</font></div><div><font face="Courier">(lldb) call DbgNode->dump()</font></div><div><font face="Courier">!{error: Execution was interrupted, reason: EXC_BAD_ACCESS (code=EXC_I386_GPFLT).</font></div><div><font face="Courier">The process has been returned to the state before expression evaluation.</font></div><div><span style="font-family: Courier;">(lldb) frame variable</span></div><div><font face="Courier">(llvm::DIDescriptor *) this = 0x00007fff5fbdba18</font></div><div><font face="Courier">(llvm::MDNode *) D = 0x0000000109d24380</font></div><div><font face="Courier">(llvm::MDNodeFwdDecl *) Node = 0x0000000102f55985</font></div><div><font face="Courier">(lldb) call D->dump()</font></div><div><font face="Courier">!{}</font></div><div><font face="Courier"><br></font></div><div><font face="Courier">(lldb) call DbgNode</font></div><div><font face="Courier">(const llvm::MDNode *) $2 = 0x000000011c81fda8</font></div><div><font face="Courier">(lldb) print *DbgNode</font></div><div><font face="Courier">(const llvm::MDNode) $3 = {</font></div><div><font face="Courier"> llvm::Metadata = {</font></div><div><font face="Courier"> SubclassID = '\0'</font></div><div><font face="Courier"> IsDistinctInContext = false</font></div><div><font face="Courier"> SubclassData16 = 0</font></div><div><font face="Courier"> SubclassData32 = 2415919104</font></div><div><font face="Courier"> }</font></div><div><font face="Courier"> Context = 0x0000000109e00009</font></div><div><font face="Courier"> NumOperands = 1</font></div><div><font face="Courier"> MDNodeSubclassData = 0</font></div><div><font face="Courier">}</font></div><div><font face="Courier">(lldb) print *D</font></div><div><font face="Courier">(llvm::MDNode) $4 = {</font></div><div><font face="Courier"> llvm::Metadata = {</font></div><div><font face="Courier"> SubclassID = '\0'</font></div><div><font face="Courier"> IsDistinctInContext = false</font></div><div><font face="Courier"> SubclassData16 = 0</font></div><div><font face="Courier"> SubclassData32 = 0</font></div><div><font face="Courier"> }</font></div><div><font face="Courier"> Context = 0x0000000109e02430</font></div><div><font face="Courier"> NumOperands = 0</font></div><div><font face="Courier"> MDNodeSubclassData = 3267742850</font></div><div><font face="Courier">}</font></div><div><span style="font-family: Courier;">(lldb) print D->Context</span></div><div><font face="Courier">(llvm::LLVMContext) $5 = {</font></div><div><font face="Courier"> pImpl = 0x000000010b003000</font></div><div><font face="Courier">}</font></div><div><font face="Courier">(lldb) print DbgNode->Context</font></div><div><font face="Courier">(llvm::LLVMContext) $6 = {</font></div><div><font face="Courier"> pImpl = 0xd00000000109d003</font></div><div><font face="Courier">}</font></div><div><font face="Courier">(lldb) </font></div></div><div><font face="Courier"><br></font></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br><div><div>On Jan 19, 2015, at 3:49 PM, Duncan P. N. Exon Smith <<a href="mailto:dexonsmith@apple.com">dexonsmith@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class="Apple-interchange-newline">On 2015-Jan-19, at 12:38, Frédéric Riss <<a href="mailto:friss@apple.com">friss@apple.com</a>> wrote:<br><br><br><blockquote type="cite">On Jan 19, 2015, at 12:04 PM, Christian Schafmeister <<a href="mailto:chris.schaf@verizon.net">chris.schaf@verizon.net</a>> wrote:<br><br><br>I forgot to mention this in my initial email.<br><br>The build of LLVM that I was using was commit a0d5d7aed8e177cea381b3d054d80c212ece9f2c<br>The date on the commit is: Date: Fri Sep 26 12:34:06 2014<br><br>Also:<br>Today I grabbed the ToT llvm/clang/clang-extra-tools and I’m working on getting my code to be compatible with it.<br><br>I can switch back and forth between the current ToT llvm and the old one.<br></blockquote><br>Hmmm, I didn’t look closely enough and I thought you were hitting an assertions I added a few weeks after that commit in the Metadata RAUW method. But it is the equivalent assertion in Value::RAUW that you are hitting and that has been there forever. Looking at your exact revision, the assertion seems to trigger while executing:<br><br>DIType(TempEnumTypes).replaceAllUsesWith(Enums);<br><br>in DIBuilder::finalize(). Can you check if TempEnumTypes is null at this point? If that is the issue (which I’m not sure), then you need to call DIBuilder::createCompileUnit() at some point.<br><br>Fred<br></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">I had a thought, too: are you using two different `LLVMContext`s? That</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">would cause the `metadata` type to compare unequal.</span></blockquote></div><br></div></body></html>