Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Assert in llvm_shutdown when running llc #10032

Closed Quuxplusone closed 10 years ago

Quuxplusone commented 12 years ago
Bugzilla Link PR11225
Status RESOLVED FIXED
Importance P normal
Reported by Thomas B. Jablin (tjablin@gmail.com)
Reported on 2011-10-24 10:57:03 -0700
Last modified on 2013-11-15 12:07:49 -0800
Version trunk
Hardware All All
CC baldrick@free.fr, bigmonachus@gmail.com, echristo@gmail.com, geek4civic@gmail.com, hammacher@cs.uni-saarland.de, kevin.streit@googlemail.com, llvm-bugs@lists.llvm.org, pks_ti@yahoo.co.in, yuanfang.chen@sony.com
Fixed by commit(s)
Attachments geti.bc (425688 bytes, application/octet-stream)
geti_min.ll (436 bytes, application/octet-stream)
geti_min.ll (444 bytes, text/plain)
bugpoint-reduced-simplified.ll (65046 bytes, application/octet-stream)
Blocks
Blocked by
See also
$ clang --version
clang version 3.0 (trunk 139501)
Target: x86_64-unknown-linux-gnu
Thread model: posix

$ llc geti.ll

While deleting: metadata %
An asserting value handle still pointed to this value!
UNREACHABLE executed at /home/tjablin/llvm-
workspace/llvm/lib/VMCore/Value.cpp:561!
0  libLLVM-3.0svn.so 0x00007fb4a456a629
1  libLLVM-3.0svn.so 0x00007fb4a456a425
2  libpthread.so.0   0x00007fb4a294e060
3  libc.so.6         0x00007fb4a1c303a5 gsignal + 53
4  libc.so.6         0x00007fb4a1c33b0b abort + 379
5  libLLVM-3.0svn.so 0x00007fb4a4554a7b
6  libLLVM-3.0svn.so 0x00007fb4a401535d
llvm::ValueHandleBase::ValueIsDeleted(llvm::Value*) + 639
7  libLLVM-3.0svn.so 0x00007fb4a4013a28 llvm::Value::~Value() + 58
8  libLLVM-3.0svn.so 0x00007fb4a3feb21a llvm::MDNode::~MDNode() + 288
9  libLLVM-3.0svn.so 0x00007fb4a3feb497 llvm::MDNode::destroy() + 67
10 libLLVM-3.0svn.so 0x00007fb4a3fe1ff5
llvm::LLVMContextImpl::~LLVMContextImpl() + 889
11 libLLVM-3.0svn.so 0x00007fb4a3fe0d19 llvm::LLVMContext::~LLVMContext() + 39
12 libLLVM-3.0svn.so 0x00007fb4a3fe15e5
llvm::object_deleter<llvm::LLVMContext>::call(void*) + 30
13 libLLVM-3.0svn.so 0x00007fb4a4559ccd llvm::ManagedStaticBase::destroy()
const + 147
14 libLLVM-3.0svn.so 0x00007fb4a4559cfb llvm::llvm_shutdown() + 21
15 llc               0x0000000000421f8d
llvm::llvm_shutdown_obj::~llvm_shutdown_obj() + 17
16 llc               0x000000000041f825 main + 2802
17 libc.so.6         0x00007fb4a1c1b30d __libc_start_main + 237
18 llc               0x000000000041e629
Stack dump:
0.      Program arguments: llc bugpoint-reduced-simplified.ll
Aborted
Quuxplusone commented 12 years ago

I can still reproduce the crash with revision 144837.

Quuxplusone commented 12 years ago

I can still reproduce this assertion with revision 146373.

Quuxplusone commented 12 years ago
I have the same issue on OS X with the released version 3.0 of llvm/clang:

===========================================================================

clang version 3.0 (tags/RELEASE_30/final)
Target: x86_64-apple-darwin11.2.0
Thread model: posix

===========================================================================

While deleting: metadata %
An asserting value handle still pointed to this value!
UNREACHABLE executed at Value.cpp:561!
0  libLLVM-3.0.dylib 0x0000000102399742 _ZL15PrintStackTracePv + 34
1  libLLVM-3.0.dylib 0x0000000102399c69 _ZL13SignalHandleri + 697
2  libsystem_c.dylib 0x00007fff8b64ccfa _sigtramp + 26
3  libsystem_c.dylib 0x0000000000000262 _sigtramp + 18446603338177525122
4  libLLVM-3.0.dylib 0x0000000102399996 abort + 22
5  libLLVM-3.0.dylib 0x0000000102388704 llvm::llvm_unreachable_internal(char
const*, char const*, unsigned int) + 468
6  libLLVM-3.0.dylib 0x0000000102025ddc
llvm::ValueHandleBase::ValueIsDeleted(llvm::Value*) + 1260
7  libLLVM-3.0.dylib 0x0000000102025641 llvm::Value::~Value() + 49
8  libLLVM-3.0.dylib 0x000000010200a806 llvm::MDNode::destroy() + 22
9  libLLVM-3.0.dylib 0x0000000102007578
llvm::LLVMContextImpl::~LLVMContextImpl() + 1816
10 libLLVM-3.0.dylib 0x000000010200628f
llvm::object_deleter<llvm::LLVMContext>::call(void*) + 31
11 libLLVM-3.0.dylib 0x000000010238c460 llvm::llvm_shutdown() + 48
12 llc               0x0000000101c88562
13 llc               0x0000000101c871c4
Stack dump:
0.      Program arguments: /usr/local/llvm/3.0/bin/llc -x86-asm-syntax=att -o
/tmp/llvm_QKkvXy/linked_executable.s /tmp/llvm_QKkvXy/linked_executable.bc
llvm-ld: Illegal instruction: 4
LLVM ERROR: Linker could not create executable!
Quuxplusone commented 12 years ago

I can reproduce this assertion in revision 150492.

Quuxplusone commented 12 years ago

Attached geti.bc (425688 bytes, application/octet-stream): Bugpoint reduced simplified testcase

Quuxplusone commented 12 years ago

Sorry, I just recognized that the reduced testcase triggeres bug 12243, for which I already applied the patch on my system. So without first patching bug 12243 you won't be able to use the attached test case.

Quuxplusone commented 12 years ago

Attached geti_min.ll (436 bytes, application/octet-stream): Further reduced test-case

Quuxplusone commented 12 years ago

Attached geti_min.ll (444 bytes, text/plain): Further reduced test case

Quuxplusone commented 12 years ago
I think I localized the bug.

In DwarfDebug.cpp, method DwarfDebug::endModule(), this code around line 750:

  LexicalScope *Scope =
    new LexicalScope(NULL, DIDescriptor(SP), NULL, false);
  DeadFnScopeMap[SP] = Scope;

Here, a new LexicalScope is allocated on the heap, and a mapping from SP (auto-
converted to MDNode*) is added to the map. In one case, the map already
contains a mapping for that MDNode*, so the old entry is lost, and the
LexicalScope, containing an AssertingVH in its Desc field, is never released.
This AssertingVH is the cause for the assertion in llvm_shutdown.

Nevertheless, I have no idea how to fix that bug :)

But I want to point out that it does not only occur on strange and illegal
debug information, like in the reduced test case, but also for regularly
compiled and linked programs.
Quuxplusone commented 12 years ago

I can reproduce this assertion with revision 156720.

Quuxplusone commented 11 years ago

I can reproduce this assertion with revision 165318.

Quuxplusone commented 11 years ago
While compiling clang with clang with "-g" option, I am also getting this
assertion violation with llc:

While deleting: metadata %
An asserting value handle still pointed to this value!
UNREACHABLE executed at
/home/ssahoo2/sw-bug-diagnosis/llvm-3.1/src/lib/VMCore/Value.cpp:620!

Has this bug been fixed in any version yet?
Quuxplusone commented 11 years ago

I can reproduce this assertion with revision 170352.

Quuxplusone commented 11 years ago

Seems to be fixed. Can't reproduce in release 3.3. Can you confirm this, Thomas?

Quuxplusone commented 11 years ago

I can no longer reproduce this assertion with revision 185734. It appears to be fixed. Thanks.

Quuxplusone commented 10 years ago
$ llc bugpoint-reduced-simplified.bc
While deleting: metadata %
!{null, null, null, metadata !"elapsed_time_", metadata !"elapsed_time_",
metadata !"elapsed_time_", null, metadata <badref>, null, null, null, null,
null, null, null, null, null, null, metadata <badref>, null}

An asserting value handle still pointed to this value!
UNREACHABLE executed at /home/arch/Build/llvm-3.3.src/lib/IR/Value.cpp:633!
0  libLLVMSupport.so 0x00007fb068e3e9e1 llvm::sys::PrintStackTrace(_IO_FILE*) +
38
1  libLLVMSupport.so 0x00007fb068e3ec5e
2  libLLVMSupport.so 0x00007fb068e3e6d7
3  libpthread.so.0   0x00007fb068705870
4  libc.so.6         0x00007fb06794d3d9 gsignal + 57
5  libc.so.6         0x00007fb06794e7d8 abort + 328
6  libLLVMSupport.so 0x00007fb068de5360
7  libLLVMCore.so    0x00007fb06989d3ca
llvm::ValueHandleBase::ValueIsDeleted(llvm::Value*) + 660
8  libLLVMCore.so    0x00007fb06989ba28 llvm::Value::~Value() + 62
9  libLLVMCore.so    0x00007fb06986b41f llvm::MDNode::~MDNode() + 279
10 libLLVMCore.so    0x00007fb06986b68f llvm::MDNode::destroy() + 67
11 libLLVMCore.so    0x00007fb06985fa98
llvm::LLVMContextImpl::~LLVMContextImpl() + 1692
12 libLLVMCore.so    0x00007fb06985dbc1 llvm::LLVMContext::~LLVMContext() + 39
13 libLLVMCore.so    0x00007fb06985e9a3
14 libLLVMSupport.so 0x00007fb068ded11f llvm::ManagedStaticBase::destroy()
const + 147
15 libLLVMSupport.so 0x00007fb068ded14d llvm::llvm_shutdown() + 21
16 llc               0x000000000041139b
17 llc               0x000000000040d0f3
18 libc.so.6         0x00007fb067939bc5 __libc_start_main + 245
19 llc               0x000000000040ca19
Stack dump:
0.      Program arguments: llc bugpoint-reduced-simplified.bc
Aborted (core dumped)
Quuxplusone commented 10 years ago

Attached bugpoint-reduced-simplified.ll (65046 bytes, application/octet-stream): new failed test case with llvm 3.3

Quuxplusone commented 10 years ago
FYI, since r190334, llc complains as below;

llc: llvm/lib/IR/DebugInfo.cpp:1413: llvm::DIScopeRef::DIScopeRef(const
llvm::Value*): Assertion `isScopeRef(V) && "DIScopeRef should be a MDString or
MDNode"' failed.

Also "opt -verify" complains.

Closing this, llc doesn't step into llvm_shutdown any more.

Please file new one, if such a complaint would be an issue to you.
Quuxplusone commented 10 years ago

Thanks, I'll bear with it util 3.4 comes out.