[LLVMbugs] [Bug 14561] New: Move-assignment of template class calling destructor crashes clang

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Dec 10 08:34:21 PST 2012


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

             Bug #: 14561
           Summary: Move-assignment of template class calling destructor
                    crashes clang
           Product: clang
           Version: 3.1
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: k.robin64 at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 9668
  --> http://llvm.org/bugs/attachment.cgi?id=9668
Preprocessed source

I have this code:

#include <utility>

template<class T>
struct TC {
    ~TC() { }
    TC& operator=(TC&& o)
    { TC::~TC(); }
};


typedef TC<int> C;

int main()
{
    C v;
    C w;
    v = std::move(w);
    return 0;
}

Compiled with:

clang++ clangbug.cc -std=c++0x

I get:

0  libLLVM-3.1.so.1 0x00007f5e1fbc4fbf
1  libLLVM-3.1.so.1 0x00007f5e1fbc5581
2  libpthread.so.0  0x00007f5e1ecddcb0
3  clang            0x0000000000e127bd
4  clang            0x0000000000e137c5
5  clang            0x0000000000e14a1f
clang::FormatASTNodeDiagnosticArgument(clang::DiagnosticsEngine::ArgumentKind,
long, char const*, unsigned int, char const*, unsigned int,
std::pair<clang::DiagnosticsEngine::ArgumentKind, long> const*, unsigned int,
llvm::SmallVectorImpl<char>&, void*, llvm::ArrayRef<long>) + 1615
6  clang            0x0000000000f5be81 clang::Diagnostic::FormatDiagnostic(char
const*, char const*, llvm::SmallVectorImpl<char>&) const + 1729
7  clang            0x00000000005df590
clang::TextDiagnosticPrinter::HandleDiagnostic(clang::DiagnosticsEngine::Level,
clang::Diagnostic const&) + 80
8  clang            0x0000000000f5e638
clang::DiagnosticIDs::ProcessDiag(clang::DiagnosticsEngine&) const + 504
9  clang            0x0000000000f58ae4
clang::DiagnosticsEngine::EmitCurrentDiagnostic() + 20
10 clang            0x0000000000875436
clang::Sema::EmitCurrentDiagnostic(unsigned int) + 630
11 clang            0x0000000000ae965b
12 clang            0x0000000000af0602
clang::Sema::FindInstantiatedDecl(clang::SourceLocation, clang::NamedDecl*,
clang::MultiLevelTemplateArgumentList const&) + 1730
13 clang            0x0000000000ac5a35
14 clang            0x0000000000ae5079
15 clang            0x0000000000ada8ba
16 clang            0x0000000000ae35a8
17 clang            0x0000000000ae3732
18 clang            0x0000000000ada0aa
19 clang            0x0000000000ae0105
20 clang            0x0000000000ae1833
21 clang            0x0000000000ae015f
22 clang            0x0000000000ae20ff clang::Sema::SubstStmt(clang::Stmt*,
clang::MultiLevelTemplateArgumentList const&) + 79
23 clang            0x0000000000af6c18
clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool) + 968
24 clang            0x0000000000af5da1
clang::Sema::PerformPendingInstantiations(bool) + 513
25 clang            0x0000000000878f7a clang::Sema::ActOnEndOfTranslationUnit()
+ 2730
26 clang            0x00000000007fc706
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 374
27 clang            0x00000000007f2e2d clang::ParseAST(clang::Sema&, bool,
bool) + 269
28 clang            0x000000000059e981
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 273
29 clang            0x000000000058767a
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1082
30 clang            0x000000000058015a cc1_main(char const**, char const**,
char const*, void*) + 6650
31 clang            0x000000000057d567 main + 615
32 libc.so.6        0x00007f5e1e41a76d __libc_start_main + 237
33 clang            0x000000000057e619
Stack dump:
0.    Program arguments: /usr/bin/clang -cc1 -triple x86_64-pc-linux-gnu
-emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name
clangbug.cc -mrelocation-model static -mdisable-fp-elim -masm-verbose
-mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-version
2.22 -momit-leaf-frame-pointer -resource-dir /usr/bin/../lib/clang/3.1
-fmodule-cache-path /var/tmp/clang-module-cache -internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/x86_64-linux-gnu
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/bin/../lib/clang/3.1/include -internal-isystem
/usr/include/clang/3.1/include/ -internal-externc-isystem 
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /usr/include -std=c++0x -fdeprecated-macro
-fdebug-compilation-dir /home/robin/code/lab -ferror-limit 19 -fmessage-length
182 -mstackrealign -fgnu-runtime -fobjc-runtime-has-arc -fobjc-runtime-has-weak
-fobjc-fragile-abi -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -o /tmp/clangbug-OSUlUY.o -x c++ clangbug.cc 
1.    <eof> parser at end of file
2.    clangbug.cc:6:9: instantiating function definition 'operator='
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang: note: diagnostic msg: Please submit a bug report to
http://llvm.org/bugs/ and include command line arguments and all diagnostic
information.
clang: note: diagnostic msg: Preprocessed source(s) and associated run
script(s) are located at:
clang: note: diagnostic msg: /tmp/clangbug-El0BkM.ii
clang: note: diagnostic msg: /tmp/clangbug-El0BkM.sh

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