[LLVMbugs] [Bug 7241] New: Missing definitions causes clang++ to crash

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu May 27 08:05:11 PDT 2010


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

           Summary: Missing definitions causes clang++ to crash
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: mmo at vizrt.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


Code, file test.hpp:

class A {
public:
    virtual ~A() { }
};

class B : public A {
public:
    virtual void test() const {}
};

class C : public B {
public:
    C();
    ~C();
};

File test.cpp:

#include "test.hpp"

class D : public C {
public:
    D() {}
};

void test() {
    D d;
}


Execution: $ clang++ -c test.cpp -v
clang version 2.0 (trunk 104832)
Target: x86_64-unknown-linux-gnu
Thread model: posix
 "/home/michael/devel/llvm/Debug/bin/clang" -cc1 -triple
x86_64-unknown-linux-gnu -S -disable-free -main-file-name test.cpp
-mrelocation-model static -mdisable-fp-elim -mconstructor-aliases
-munwind-tables -target-cpu x86-64 -v -resource-dir
/home/michael/devel/llvm/Debug/lib/clang/2.0 -ferror-limit 19 -fmessage-length
240 -fexceptions -fgnu-runtime -fdiagnostics-show-option -fcolor-diagnostics -o
/tmp/cc-nXO2eG.s -x c++ test.cpp
clang -cc1 version 2.0 based upon llvm 2.8svn hosted on
x86_64-unknown-linux-gnu
...
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/4.4
 /usr/include/c++/4.4/x86_64-linux-gnu
 /usr/include/c++/4.4/backward
 /usr/local/include
 /home/michael/devel/llvm/Debug/lib/clang/2.0/include
 /usr/include
End of search list.
clang: CodeGenModule.cpp:831: llvm::Constant*
clang::CodeGen::CodeGenModule::GetOrCreateLLVMFunction(llvm::StringRef, const
llvm::Type*, clang::CodeGen::GlobalDecl): Assertion `DD->isUsed() && "Sema
doesn't consider destructor as used."' failed.
0  clang           0x00000000014f6de6
1  clang           0x00000000014f6cbd
2  libpthread.so.0 0x00007f873e7678f0
3  libc.so.6       0x00007f873da57a75 gsignal + 53
4  libc.so.6       0x00007f873da5b5c0 abort + 384
5  libc.so.6       0x00007f873da50941 __assert_fail + 241
6  clang           0x000000000058079d
7  clang           0x00000000005809cf
8  clang           0x0000000000670811
9  clang           0x0000000000670d33
10 clang           0x000000000067124f
11 clang           0x000000000057f3a8
12 clang           0x000000000057db6a
13 clang           0x000000000057c7b9
14 clang           0x0000000000427dfd
15 clang           0x00000000006aa3c2
16 clang           0x0000000000443b08
17 clang           0x0000000000443773
18 clang           0x000000000042e40e
19 clang           0x000000000040933f
20 clang           0x0000000000411f9c main + 357
21 libc.so.6       0x00007f873da42c4d __libc_start_main + 253
22 clang           0x0000000000407cb9
Stack dump:
0.      Program arguments: /home/michael/devel/llvm/Debug/bin/clang -cc1
-triple x86_64-unknown-linux-gnu -S -disable-free -main-file-name test.cpp
-mrelocation-model static -mdisable-fp-elim -mconstructor-aliases
-munwind-tables -target-cpu x86-64 -v -resource-dir
/home/michael/devel/llvm/Debug/lib/clang/2.0 -ferror-limit 19 -fmessage-length
240 -fexceptions -fgnu-runtime -fdiagnostics-show-option -fcolor-diagnostics -o
/tmp/cc-nXO2eG.s -x c++ test.cpp 
1.      <eof> parser at end of file
2.      Per-file LLVM IR generation
clang: error: clang frontend command failed due to signal 6 (use -v to see
invocation)


Stack trace:
#0  0x00007ffff6ebfa75 in *__GI_raise (sig=<value optimized out>) at
../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1  0x00007ffff6ec35c0 in *__GI_abort () at abort.c:92
#2  0x00007ffff6eb8941 in *__GI___assert_fail (assertion=0x154f868
"DD->isUsed() && \"Sema doesn't consider destructor as used.\"", file=<value
optimized out>, line=831, 
    function=0x1554380 "llvm::Constant*
clang::CodeGen::CodeGenModule::GetOrCreateLLVMFunction(llvm::StringRef, const
llvm::Type*, clang::CodeGen::GlobalDecl)") at assert.c:81
#3  0x000000000058079d in
clang::CodeGen::CodeGenModule::GetOrCreateLLVMFunction (this=0x231efa0,
MangledName=..., Ty=0x233ffa0, D=...) at CodeGenModule.cpp:831
#4  0x00000000005809cf in clang::CodeGen::CodeGenModule::GetAddrOfFunction
(this=0x231efa0, GD=..., Ty=0x233ffa0) at CodeGenModule.cpp:862
#5  0x0000000000670811 in
clang::CodeGen::CodeGenVTables::CreateVTableInitializer (this=0x231f1f8,
RD=0x2333c80, Components=0x234f108, NumComponents=5, VTableThunks=...) at
CGVTables.cpp:2955
#6  0x0000000000670d33 in clang::CodeGen::CodeGenVTables::EmitVTableDefinition
(this=0x231f1f8, VTable=0x234ee58, Linkage=llvm::GlobalValue::WeakODRLinkage,
RD=0x2333c80) at CGVTables.cpp:3052
#7  0x000000000067124f in clang::CodeGen::CodeGenVTables::GenerateClassData
(this=0x231f1f8, Linkage=llvm::GlobalValue::WeakODRLinkage, RD=0x2333c80) at
CGVTables.cpp:3118
#8  0x000000000057f3a8 in clang::CodeGen::CodeGenModule::EmitDeferred
(this=0x231efa0) at CodeGenModule.cpp:509
#9  0x000000000057db6a in clang::CodeGen::CodeGenModule::Release
(this=0x231efa0) at CodeGenModule.cpp:94
#10 0x000000000057c7b9 in HandleTranslationUnit (this=0x2301d20, Ctx=...) at
ModuleBuilder.cpp:83
#11 0x0000000000427dfd in HandleTranslationUnit (this=0x230a6a0, C=...) at
CodeGenAction.cpp:159
#12 0x00000000006aa3c2 in clang::ParseAST (PP=..., Consumer=0x230a6a0, Ctx=...,
PrintStats=false, CompleteTranslationUnit=true, CompletionConsumer=0x0) at
ParseAST.cpp:108
#13 0x0000000000443b08 in clang::ASTFrontendAction::ExecuteAction
(this=0x22f5710) at FrontendAction.cpp:224
#14 0x0000000000443773 in clang::FrontendAction::Execute (this=0x22f5710) at
FrontendAction.cpp:150
#15 0x000000000042e40e in clang::CompilerInstance::ExecuteAction
(this=0x22efc90, Act=...) at CompilerInstance.cpp:513
#16 0x000000000040933f in cc1_main (ArgBegin=0x7fffffffe1d8,
ArgEnd=0x7fffffffe2b8, Argv0=0x7fffffffe54b "/opt/bin/clang",
MainAddr=0x411058) at cc1_main.cpp:286
#17 0x0000000000411f9c in main (argc=30, argv=0x7fffffffe1c8) at driver.cpp:186

-- 
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