[LLVMdev] how to fix this "Expected no forward declarations!" assertion fail

John Criswell jtcriswel at gmail.com
Wed May 27 13:40:21 PDT 2015


On 5/27/15 3:28 PM, Hui Zhang wrote:
> Hello, John
>
> On Wed, May 27, 2015 at 3:37 PM, John Criswell <jtcriswel at gmail.com 
> <mailto:jtcriswel at gmail.com>> wrote:
>
>     On 5/27/15 8:12 AM, Hui Zhang wrote:
>>     Hello, Everyone
>>
>>     I'm using llvm 3.6 DIBuilder module to build the debug
>>     information for Chapel language(the Chapel-llvm front end works
>>     fine). When I run the test program, I got these assertions failed:
>>     !718
>>     Expected no forward declarations!
>>     !719
>>     Expected no forward declarations!
>>     !720
>>     Expected no forward declarations!
>>     !721
>>     Expected no forward declarations!
>>     !722
>>     All nodes should be resolved!
>>     !716
>>
>>     How should I debug it since the bitcode file isn't generated and
>>     I can't see what exactly those MDNodes represent...
>
>     You can probably disable the pass that verifies the LLVM bitcode. 
>     If you're using opt, there's a command-line option for that (use
>     --help-hidden to find it).  If you're using a custom tool, you'll
>     either need to f
>     ​​
>     ind the option or modify its source code to disable it.
>
>
> ​Here, ​"​ind the option or modify its source code to disable it", you 
> mean change the source code of the custom tool(I'm not using opt) that 
> trigger this assertion failure ? The part of code that cause the 
> failure is below:
>     #if HAVE_LLVM_VER >= 35
>         problems = verifyModule(*info->module, &errs());
>     #else
>         problems = verifyModule(*info->module, PrintMessageAction);
>     #endif
>      if(problems) {
>           INT_FATAL("LLVM module verification failed");
>
> So you think I should just remove that "verifyModule" line ?

Yes.  If the error isn't too bad, you can probably get a malformed LLVM 
bitcode file that you can disassemble with llvm-dis and examine.

>
>     Alternatively, run the program through a debugger so that you
>     break into the debugger when it hits the assertion.  You can then
>     use the debugger to examine the IR (using the dump() methods of
>     various LLVM classes) and see what is causing the problem.
>
>
> ​I started it in gdb, but how to use dump() in gdb  ?

Let's say that gdb stops due to an assertion, and there's a local 
variable of type Instruction * called inst.  If you use the command 
"call inst->dump()" in gdb, it will call Instruction::dump() on inst, 
causing it to print out the instruction.

Most LLVM classes (Instruction, BasicBlock, Function, Constant) have a 
dump() method that you can call to print the human-readable version of 
the object in the debugger.  For more information on calling C++ methods 
in gdb, you can consult the gdb documentation.

Regards,

John Criswell

> Thanks
>
>
>     Regards,
>
>     John Criswell
>
>>
>>     Any information would be great appreciated, not found any useful
>>     posts online  yet
>>
>>     Thanks a lot !
>>
>>     -- 
>>     Best regards
>>
>>
>>     Hui Zhang
>>
>>
>>     _______________________________________________
>>     LLVM Developers mailing list
>>     LLVMdev at cs.uiuc.edu  <mailto:LLVMdev at cs.uiuc.edu>          http://llvm.cs.uiuc.edu
>>     http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
>     -- 
>     John Criswell
>     Assistant Professor
>     Department of Computer Science, University of Rochester
>     http://www.cs.rochester.edu/u/criswell
>
>
>
>
> -- 
> Best regards
>
>
> Hui Zhang


-- 
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
http://www.cs.rochester.edu/u/criswell

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150527/35379ec6/attachment.html>


More information about the llvm-dev mailing list