[LLVMbugs] [Bug 23952] New: Crash on explicit destructor call in move assignment operator

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jun 25 08:53:06 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=23952

            Bug ID: 23952
           Summary: Crash on explicit destructor call in move assignment
                    operator
           Product: clang
           Version: 3.6
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: davorin.ucakar at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Compiling the following minimal case crashes Clang:

template <typename Elem>
struct List
{
  List() = default;
  ~List() = default;

  List& operator = (List&&)
  {
    List::~List();
    return *this;
  }
};

int main()
{
  List<int> f1, f2;
  f2 = static_cast<List<int>&&>(f1);
  return 0;
}

[davorin at lumpy tests]$ clang++ -v -std=c++11 scratch.cc    
clang version 3.6.1 (tags/RELEASE_361/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation:
/usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.1.0
Found candidate GCC installation:
/usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/5.1.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-unknown-linux-gnu/5.1.0
Found candidate GCC installation: /usr/lib64/gcc/x86_64-unknown-linux-gnu/5.1.0
Selected GCC installation: /usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/5.1.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
 "/usr/bin/clang" -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all
-disable-free -disable-llvm-verifier -main-file-name scratch.cc
-mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno
-masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array
-target-cpu x86-64 -target-linker-version 2.25.0 -v -dwarf-column-info
-resource-dir /usr/bin/../lib/clang/3.6.1 -internal-isystem
/usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../include/c++/5.1.0
-internal-isystem
/usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../include/c++/5.1.0/x86_64-unknown-linux-gnu
-internal-isystem
/usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../include/c++/5.1.0/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/bin/../lib/clang/3.6.1/include -internal-externc-isystem /include
-internal-externc-isystem /usr/include -std=c++11 -fdeprecated-macro
-fdebug-compilation-dir /home/davorin/Razvoj/openzone/src/tests -ferror-limit
19 -fmessage-length 157 -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o
/tmp/scratch-201313.o -x c++ scratch.cc
clang -cc1 version 3.6.1 based upon LLVM 3.6.1 default target
x86_64-unknown-linux-gnu
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:

/usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../include/c++/5.1.0

/usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../include/c++/5.1.0/x86_64-unknown-linux-gnu

/usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../include/c++/5.1.0/backward
 /usr/local/include
 /usr/bin/../lib/clang/3.6.1/include
 /usr/include
End of search list.
#0 0x7faf77f58822 llvm::sys::PrintStackTrace(_IO_FILE*)
(/usr/bin/../lib/libLLVM-3.6.so+0xf97822)
#1 0x7faf77f56e19 (/usr/bin/../lib/libLLVM-3.6.so+0xf95e19)
#2 0x7faf76db4660 __restore_rt (/usr/bin/../lib/libpthread.so.0+0x10660)
#3 0x120a037 (/usr/bin/clang+0x120a037)
#4 0x120a739 (/usr/bin/clang+0x120a739)
#5 0x120b1fa
clang::FormatASTNodeDiagnosticArgument(clang::DiagnosticsEngine::ArgumentKind,
long, llvm::StringRef, llvm::StringRef,
llvm::ArrayRef<std::pair<clang::DiagnosticsEngine::ArgumentKind, long> >,
llvm::SmallVectorImpl<char>&, void*, llvm::ArrayRef<long>)
(/usr/bin/clang+0x120b1fa)
#6 0x13ed070 clang::Diagnostic::FormatDiagnostic(char const*, char const*,
llvm::SmallVectorImpl<char>&) const (/usr/bin/clang+0x13ed070)
#7 0x70de2f
clang::TextDiagnosticPrinter::HandleDiagnostic(clang::DiagnosticsEngine::Level,
clang::Diagnostic const&) (/usr/bin/clang+0x70de2f)
#8 0x13ef060 clang::DiagnosticIDs::EmitDiag(clang::DiagnosticsEngine&,
clang::DiagnosticIDs::Level) const (/usr/bin/clang+0x13ef060)
#9 0x13ef2b6 clang::DiagnosticIDs::ProcessDiag(clang::DiagnosticsEngine&) const
(/usr/bin/clang+0x13ef2b6)
#10 0x13e8384 clang::DiagnosticsEngine::EmitCurrentDiagnostic(bool)
(/usr/bin/clang+0x13e8384)
#11 0xac311a clang::Sema::EmitCurrentDiagnostic(unsigned int)
(/usr/bin/clang+0xac311a)
#12 0xac366b (/usr/bin/clang+0xac366b)
#13 0xde9c1a clang::Sema::FindInstantiatedDecl(clang::SourceLocation,
clang::NamedDecl*, clang::MultiLevelTemplateArgumentList const&)
(/usr/bin/clang+0xde9c1a)
#14 0xdbbd2f (/usr/bin/clang+0xdbbd2f)
#15 0xdd1fdf (/usr/bin/clang+0xdd1fdf)
#16 0xdc2ad7 (/usr/bin/clang+0xdc2ad7)
#17 0xdc6e1f (/usr/bin/clang+0xdc6e1f)
#18 0xdc2cd1 (/usr/bin/clang+0xdc2cd1)
#19 0xdd899d (/usr/bin/clang+0xdd899d)
#20 0xdd964b (/usr/bin/clang+0xdd964b)
#21 0xdd978b (/usr/bin/clang+0xdd978b)
#22 0xdd8c95 (/usr/bin/clang+0xdd8c95)
#23 0xddbe7f clang::Sema::SubstStmt(clang::Stmt*,
clang::MultiLevelTemplateArgumentList const&) (/usr/bin/clang+0xddbe7f)
#24 0xdefd82 clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool) (/usr/bin/clang+0xdefd82)
#25 0xdeef6b clang::Sema::PerformPendingInstantiations(bool)
(/usr/bin/clang+0xdeef6b)
#26 0xac94df clang::Sema::ActOnEndOfTranslationUnit() (/usr/bin/clang+0xac94df)
#27 0xa25330
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/usr/bin/clang+0xa25330)
#28 0xa1ad73 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/bin/clang+0xa1ad73)
#29 0x6d4b36 clang::FrontendAction::Execute() (/usr/bin/clang+0x6d4b36)
#30 0x6af2c9 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/bin/clang+0x6af2c9)
#31 0x696554 clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/bin/clang+0x696554)
#32 0x690e40 cc1_main(llvm::ArrayRef<char const*>, char const*, void*)
(/usr/bin/clang+0x690e40)
#33 0x68de7b main (/usr/bin/clang+0x68de7b)
#34 0x7faf7648a790 __libc_start_main (/usr/bin/../lib/libc.so.6+0x20790)
#35 0x690499 _start (/usr/bin/clang+0x690499)
Stack dump:
0.      Program arguments: /usr/bin/clang -cc1 -triple x86_64-unknown-linux-gnu
-emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name
scratch.cc -mrelocation-model static -mthread-model posix -mdisable-fp-elim
-fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables
-fuse-init-array -target-cpu x86-64 -target-linker-version 2.25.0 -v
-dwarf-column-info -resource-dir /usr/bin/../lib/clang/3.6.1 -internal-isystem
/usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../include/c++/5.1.0
-internal-isystem
/usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../include/c++/5.1.0/x86_64-unknown-linux-gnu
-internal-isystem
/usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../include/c++/5.1.0/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/bin/../lib/clang/3.6.1/include -internal-externc-isystem /include
-internal-externc-isystem /usr/include -std=c++11 -fdeprecated-macro
-fdebug-compilation-dir /home/davorin/Razvoj/openzone/src/tests -ferror-limit
19 -fmessage-length 157 -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o
/tmp/scratch-201313.o -x c++ scratch.cc
1.      <eof> parser at end of file
2.      scratch.cc:7: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 version 3.6.1 (tags/RELEASE_361/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and
associated run script.
clang: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/scratch-bfeea6.cpp
clang: note: diagnostic msg: /tmp/scratch-bfeea6.sh
clang: note: diagnostic msg:

********************

/tmp/scratch-bfeea6.cpp:

# 1 "<built-in>"
# 1 "scratch.cc"
template <typename Elem>
struct List
{
  List() = default;
  ~List() = default;

  List& operator = (List&&)
  {
    List::~List();
    return *this;
  }
};

int main()
{
  List<int> f1, f2;
  f2 = static_cast<List<int>&&>(f1);
  return 0;
}

/tmp/scratch-bfeea6.sh:

 "/usr/bin/clang" "-cc1" "-triple" "x86_64-unknown-linux-gnu" "-emit-obj"
"-mrelax-all" "-disable-free" "-disable-llvm-verifier" "-main-file-name"
"scratch.cc" "-mrelocation-model" "static" "-mthread-model" "posix"
"-mdisable-fp-elim" "-fmath-errno" "-masm-verbose" "-mconstructor-aliases"
"-munwind-tables" "-fuse-init-array" "-target-cpu" "x86-64"
"-target-linker-version" "2.25.0" "-v" "-dwarf-column-info" "-std=c++11"
"-fdeprecated-macro" "-ferror-limit" "19" "-fmessage-length" "157"
"-mstackrealign" "-fobjc-runtime=gcc" "-fcxx-exceptions" "-fexceptions"
"-fdiagnostics-show-option" "-fcolor-diagnostics" "-x" "c++"
"scratch-bfeea6.cpp"

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150625/8265ae07/attachment.html>


More information about the llvm-bugs mailing list