[llvm-bugs] [Bug 28060] New: clang crashes on valid C++11 code: Assertion `Lookup.size() == 1' failed

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jun 8 16:45:02 PDT 2016


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

            Bug ID: 28060
           Summary: clang crashes on valid C++11 code: Assertion
                    `Lookup.size() == 1' failed
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: su at cs.ucdavis.edu
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

The current clang trunk crashes when compiling the following valid C++11 test
case on x86_64-linux-gnu in both 32-bit and 64-bit modes. 

This is a regression from 3.8.x (it also crashes at least 3.5.x to 3.7.x). 


$ clang++ -v
clang version 3.9.0 (trunk 272125)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.3.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$
$ clang++-3.8 -std=c++11 small.cpp
$ g++-6.1 small.cpp
$
$ clang++ -std=c++11 small.cpp
clang-3.9:
/tmp/llvm-builder/llvm-source-trunk/tools/clang/lib/Sema/SemaTemplateInstantiate.cpp:2640:
void clang::Sema::InstantiateClassMembers(clang::SourceLocation,
clang::CXXRecordDecl*, const clang::MultiLevelTemplateArgumentList&,
clang::TemplateSpecializationKind): Assertion `Lookup.size() == 1' failed.
#0 0x0000000001e1c7e5 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-3.9+0x1e1c7e5)
#1 0x0000000001e1a776 llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-3.9+0x1e1a776)
#2 0x0000000001e1a994 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-3.9+0x1e1a994)
#3 0x00007fc61a895340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x00007fc619ab3cc9 gsignal
/build/eglibc-3GlaMS/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007fc619ab70d8 abort
/build/eglibc-3GlaMS/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007fc619aacb86 __assert_fail_base
/build/eglibc-3GlaMS/eglibc-2.19/assert/assert.c:92:0
#7 0x00007fc619aacc32 (/lib/x86_64-linux-gnu/libc.so.6+0x2fc32)
#8 0x0000000002f4b201 (/usr/local/clang-trunk/bin/clang-3.9+0x2f4b201)
#9 0x0000000002f7b0c0
clang::TemplateDeclInstantiator::VisitCXXRecordDecl(clang::CXXRecordDecl*)
(/usr/local/clang-trunk/bin/clang-3.9+0x2f7b0c0)
#10 0x0000000002f79485 clang::Sema::SubstDecl(clang::Decl*,
clang::DeclContext*, clang::MultiLevelTemplateArgumentList const&)
(/usr/local/clang-trunk/bin/clang-3.9+0x2f79485)
#11 0x0000000002f3c37c clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformDeclStmt(clang::DeclStmt*)
(/usr/local/clang-trunk/bin/clang-3.9+0x2f3c37c)
#12 0x0000000002f519e3 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformStmt(clang::Stmt*)
(/usr/local/clang-trunk/bin/clang-3.9+0x2f519e3)
#13 0x0000000002f52714 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt*,
bool) (/usr/local/clang-trunk/bin/clang-3.9+0x2f52714)
#14 0x0000000002f5284b clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt*)
(/usr/local/clang-trunk/bin/clang-3.9+0x2f5284b)
#15 0x0000000002f51a33 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformStmt(clang::Stmt*)
(/usr/local/clang-trunk/bin/clang-3.9+0x2f51a33)
#16 0x0000000002f55e28 clang::Sema::SubstStmt(clang::Stmt*,
clang::MultiLevelTemplateArgumentList const&)
(/usr/local/clang-trunk/bin/clang-3.9+0x2f55e28)
#17 0x0000000002f7c231
clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool, bool)
(/usr/local/clang-trunk/bin/clang-3.9+0x2f7c231)
#18 0x0000000002f7aa17 clang::Sema::PerformPendingInstantiations(bool)
(/usr/local/clang-trunk/bin/clang-3.9+0x2f7aa17)
#19 0x0000000002b3932d clang::Sema::ActOnEndOfTranslationUnit()
(/usr/local/clang-trunk/bin/clang-3.9+0x2b3932d)
#20 0x000000000292f841
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/usr/local/clang-trunk/bin/clang-3.9+0x292f841)
#21 0x0000000002926d6b clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-3.9+0x2926d6b)
#22 0x00000000025c5f3e clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-3.9+0x25c5f3e)
#23 0x0000000002291eae clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-3.9+0x2291eae)
#24 0x0000000002267916
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-3.9+0x2267916)
#25 0x000000000231f012
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-3.9+0x231f012)
#26 0x0000000000aec798 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-3.9+0xaec798)
#27 0x0000000000aa0f8e main (/usr/local/clang-trunk/bin/clang-3.9+0xaa0f8e)
#28 0x00007fc619a9eec5 __libc_start_main
/build/eglibc-3GlaMS/eglibc-2.19/csu/libc-start.c:321:0
#29 0x0000000000ae8804 _start (/usr/local/clang-trunk/bin/clang-3.9+0xae8804)
Stack dump:
0.      Program arguments: /usr/local/clang-trunk/bin/clang-3.9 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
small.cpp -mrelocation-model static -mthread-model posix -mdisable-fp-elim
-fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables
-fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb
-resource-dir /usr/local/clang-trunk/bin/../lib/clang/3.9.0 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/local/clang-trunk/bin/../lib/clang/3.9.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -std=c++11 -fdeprecated-macro
-fdebug-compilation-dir /data2 -ferror-limit 19 -fmessage-length 163
-fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -o /tmp/small-f6a36f.o -x c++ small.cpp
1.      <eof> parser at end of file
2.      small.cpp:2:6: instantiating function definition 'foo<int>'
clang-3.9: error: unable to execute command: Aborted (core dumped)
clang-3.9: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.9.0 (trunk 272125)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/bin
clang-3.9: 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-3.9: note: diagnostic msg:
********************

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

********************
$


-------------------------


template < class T >
void foo (T v)
{ 
  struct s
  { 
    T *s = 0;
  };
}

int main ()
{ 
  foo (0);
  return 0;
}

-- 
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/20160608/ce69418a/attachment.html>


More information about the llvm-bugs mailing list