[LLVMbugs] [Bug 6106] New: llvm::dbgs() causes endless loop on NDEBUG builds.

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Thu Jan 21 13:19:19 PST 2010


http://llvm.org/bugs/show_bug.cgi?id=6106

           Summary: llvm::dbgs() causes endless loop on NDEBUG builds.
           Product: new-bugs
           Version: unspecified
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: xerxes at zafena.se
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=4086)
 --> (http://llvm.org/bugs/attachment.cgi?id=4086)
dbgs_to_errs.patch

When setting llvm::PrintMachineCode = 1; to make the llvm JIT print machine
code after each optimization pass and linked to a ReleaseWithDebInfo causes a
enless loop when creating the llvm jit execution engine.

debugging the running process (openjdk in this case) makes it clear that
Debug.cpp:119 needs fixing for NDEBUG builds, 

The proposed attached patch fixed this issue for NDEBUG builds by making
llvm::dbgs() return errs() instead of recursively returning itself.

(gdb) bt
#0  llvm::dbgs () at /sd/llvm/lib/Support/Debug.cpp:119
#1  0x40752cf0 in printAndVerify (PM=@0x94fb0, Banner=0x40a2ed5c "After
Instruction Selection", allowDoubleDefs=true) at
/sd/llvm/lib/CodeGen/LLVMTargetMachine.cpp:261
#2  0x40753118 in llvm::LLVMTargetMachine::addCommonCodeGenPasses
(this=0x95038, PM=@0x94fb0, OptLevel=llvm::CodeGenOpt::Default) at
/sd/llvm/lib/CodeGen/LLVMTargetMachine.cpp:340
#3  0x407536b0 in llvm::LLVMTargetMachine::addPassesToEmitMachineCode
(this=0x95038, PM=@0x94fb0, JCE=@0x99110, OptLevel=llvm::CodeGenOpt::Default)
at /sd/llvm/lib/CodeGen/LLVMTargetMachine.cpp:245
#4  0x40723eac in JIT (this=0x973b0, MP=<value optimized out>, tm=<value
optimized out>, tji=<value optimized out>, JMM=0x94ef8,
OptLevel=llvm::CodeGenOpt::Default, GVsWithCode=<value optimized out>) at
/sd/llvm/lib/ExecutionEngine/JIT/JIT.cpp:249
#5  0x40724080 in llvm::JIT::createJIT (MP=0x7eac8, ErrorStr=<value optimized
out>, JMM=0x94ef8, OptLevel=llvm::CodeGenOpt::Default, GVsWithCode=true,
CMM=28) at /sd/llvm/lib/ExecutionEngine/JIT/JIT.cpp:224
#6  0x404aa93c in SharkCompiler (this=0x8b780) at
/media/disk/icedtea6-tot/openjdk-ecj/hotspot/src/share/vm/shark/sharkCompiler.cpp:60
#7  0x402aa0a4 in CompileBroker::compilation_init () at
/media/disk/icedtea6-tot/openjdk-ecj/hotspot/src/share/vm/compiler/compileBroker.cpp:561
#8  0x404e7c20 in Threads::create_vm (args=<value optimized out>,
canTryAgain=<value optimized out>) at
/media/disk/icedtea6-tot/openjdk-ecj/hotspot/src/share/vm/runtime/thread.cpp:3141
#9  0x40372f44 in JNI_CreateJavaVM (vm=0x40d22dfc, penv=0x40d22df8,
args=0x40d22de8) at
/media/disk/icedtea6-tot/openjdk-ecj/hotspot/src/share/vm/prims/jni.cpp:3263
#10 0x0000a2d0 in JavaMain (_args=<value optimized out>) at
../../../../src/share/bin/java.c:1310
#11 0x4005e30c in start_thread () from /lib/vfp/libpthread.so.0
#12 0x40155d38 in clone () from /lib/vfp/libc.so.6
Backtrace stopped: frame did not save the PC
(gdb) 

(gdb) disassemble 
Dump of assembler code for function _ZN4llvm4dbgsEv:
0x409b6034 <llvm::dbgs()+0>:    b       0x409b6034 <llvm::dbgs()>
End of assembler dump.
(gdb)

Cheers
Xerxes


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list