[llvm-bugs] [Bug 30313] New: clang crashes on invalid C++ code with "-std=c++11": UNREACHABLE executed at /tmp/llvm-builder/llvm-source-trunk/tools/clang/lib/Sema/SemaTemplate.cpp:3167

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Sep 7 12:14:29 PDT 2016


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

            Bug ID: 30313
           Summary: clang crashes on invalid C++ code with "-std=c++11":
                    UNREACHABLE executed at
                    /tmp/llvm-builder/llvm-source-trunk/tools/clang/lib/Se
                    ma/SemaTemplate.cpp:3167
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: su at cs.ucdavis.edu
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

It affects at least all versions 3.2 and later. 


$ clang++ -v
clang version 4.0.0 (trunk 280730)
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
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
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.1.1
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++ -c -std=c++11 small.cpp
small.cpp:1:1: error: use of undeclared identifier 'T'
T::template operator "" f < 0 >;
^
literal operator id cannot have a dependent scope
UNREACHABLE executed at
/tmp/llvm-builder/llvm-source-trunk/tools/clang/lib/Sema/SemaTemplate.cpp:3167!
#0 0x0000000001e484f5 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-4.0+0x1e484f5)
#1 0x0000000001e465de llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-4.0+0x1e465de)
#2 0x0000000001e46740 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-4.0+0x1e46740)
#3 0x00007fb925d37340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x00007fb924b28cc9 gsignal
/build/eglibc-3GlaMS/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007fb924b2c0d8 abort
/build/eglibc-3GlaMS/eglibc-2.19/stdlib/abort.c:91:0
#6 0x0000000001dfa47a (/usr/local/clang-trunk/bin/clang-4.0+0x1dfa47a)
#7 0x0000000002f2a900 clang::Sema::ActOnDependentTemplateName(clang::Scope*,
clang::CXXScopeSpec&, clang::SourceLocation, clang::UnqualifiedId&,
clang::OpaquePtr<clang::QualType>, bool,
clang::OpaquePtr<clang::TemplateName>&)
(/usr/local/clang-trunk/bin/clang-4.0+0x2f2a900)
#8 0x00000000029d0e80
clang::Parser::ParseOptionalCXXScopeSpecifier(clang::CXXScopeSpec&,
clang::OpaquePtr<clang::QualType>, bool, bool*, bool, clang::IdentifierInfo**)
(/usr/local/clang-trunk/bin/clang-4.0+0x29d0e80)
#9 0x000000000297b94a clang::Parser::TryAnnotateCXXScopeToken(bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x297b94a)
#10 0x000000000299940c
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*)
(/usr/local/clang-trunk/bin/clang-4.0+0x299940c)
#11 0x000000000297c046
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/usr/local/clang-trunk/bin/clang-4.0+0x297c046)
#12 0x000000000297c7b1
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) [clone .part.223]
(/usr/local/clang-trunk/bin/clang-4.0+0x297c7b1)
#13 0x000000000297c7ef
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
(/usr/local/clang-trunk/bin/clang-4.0+0x297c7ef)
#14 0x00000000029813e0
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (/usr/local/clang-trunk/bin/clang-4.0+0x29813e0)
#15 0x0000000002981f12
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/usr/local/clang-trunk/bin/clang-4.0+0x2981f12)
#16 0x000000000298214c
clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/usr/local/clang-trunk/bin/clang-4.0+0x298214c)
#17 0x000000000297937b clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x297937b)
#18 0x00000000025ea82e clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-4.0+0x25ea82e)
#19 0x00000000022e8cce clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-4.0+0x22e8cce)
#20 0x00000000022be326
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-4.0+0x22be326)
#21 0x00000000023783d2
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-4.0+0x23783d2)
#22 0x0000000000b567a0 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-4.0+0xb567a0)
#23 0x0000000000b0123f main (/usr/local/clang-trunk/bin/clang-4.0+0xb0123f)
#24 0x00007fb924b13ec5 __libc_start_main
/build/eglibc-3GlaMS/eglibc-2.19/csu/libc-start.c:321:0
#25 0x0000000000b528fe _start (/usr/local/clang-trunk/bin/clang-4.0+0xb528fe)
Stack dump:
0.      Program arguments: /usr/local/clang-trunk/bin/clang-4.0 -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
-coverage-notes-file /data2/small.gcno -resource-dir
/usr/local/clang-trunk/bin/../lib/clang/4.0.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/4.0.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 201
-fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -o small.o -x c++ small.cpp
1.      small.cpp:1:27: current parser token '<'
clang-4.0: error: unable to execute command: Aborted (core dumped)
clang-4.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 4.0.0 (trunk 280730)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/bin
clang-4.0: 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-4.0: note: diagnostic msg:
********************

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

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


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


T::template operator "" f < 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/20160907/e9d8e6ca/attachment.html>


More information about the llvm-bugs mailing list