[llvm-bugs] [Bug 28494] New: clang crashes on invalid C++14 code with __make_integer_seq: Assertion `isa<FunctionTemplateDecl>(Template) && "Only function templates are possible here"' failed

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jul 10 21:52:24 PDT 2016


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

            Bug ID: 28494
           Summary: clang crashes on invalid C++14 code with
                    __make_integer_seq: Assertion
                    `isa<FunctionTemplateDecl>(Template) && "Only function
                    templates are possible here"' failed
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++14
          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 (invalid) C++14
test case on x86_64-linux-gnu in both 32-bit and 64-bit modes. 

This is a regression from 3.8.x. 


$ clang++ -v
clang version 3.9.0 (trunk 275012)
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++14 small.cpp
clang-3.9:
/tmp/llvm-builder/llvm-source-trunk/tools/clang/lib/Sema/SemaTemplate.cpp:5382:
bool clang::Sema::CheckTemplateArgument(clang::TemplateTemplateParmDecl*,
clang::TemplateArgumentLoc&, unsigned int): Assertion
`isa<FunctionTemplateDecl>(Template) && "Only function templates are possible
here"' failed.
#0 0x0000000001d5c015 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-3.9+0x1d5c015)
#1 0x0000000001d5a0ce llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-3.9+0x1d5a0ce)
#2 0x0000000001d5a230 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-3.9+0x1d5a230)
#3 0x00007ff896635340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x00007ff895426cc9 gsignal
/build/eglibc-3GlaMS/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007ff89542a0d8 abort
/build/eglibc-3GlaMS/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007ff89541fb86 __assert_fail_base
/build/eglibc-3GlaMS/eglibc-2.19/assert/assert.c:92:0
#7 0x00007ff89541fc32 (/lib/x86_64-linux-gnu/libc.so.6+0x2fc32)
#8 0x0000000002dd0941
clang::Sema::CheckTemplateArgument(clang::TemplateTemplateParmDecl*,
clang::TemplateArgumentLoc&, unsigned int)
(/usr/local/clang-trunk/bin/clang-3.9+0x2dd0941)
#9 0x0000000002ddd44d clang::Sema::CheckTemplateArgument(clang::NamedDecl*,
clang::TemplateArgumentLoc&, clang::NamedDecl*, clang::SourceLocation,
clang::SourceLocation, unsigned int,
llvm::SmallVectorImpl<clang::TemplateArgument>&,
clang::Sema::CheckTemplateArgumentKind)
(/usr/local/clang-trunk/bin/clang-3.9+0x2ddd44d)
#10 0x0000000002ddd99d
clang::Sema::CheckTemplateArgumentList(clang::TemplateDecl*,
clang::SourceLocation, clang::TemplateArgumentListInfo&, bool,
llvm::SmallVectorImpl<clang::TemplateArgument>&)
(/usr/local/clang-trunk/bin/clang-3.9+0x2ddd99d)
#11 0x0000000002ddedd7 clang::Sema::CheckTemplateIdType(clang::TemplateName,
clang::SourceLocation, clang::TemplateArgumentListInfo&)
(/usr/local/clang-trunk/bin/clang-3.9+0x2ddedd7)
#12 0x0000000002de008b clang::Sema::ActOnTemplateIdType(clang::CXXScopeSpec&,
clang::SourceLocation, clang::OpaquePtr<clang::TemplateName>,
clang::SourceLocation, clang::SourceLocation,
llvm::MutableArrayRef<clang::ParsedTemplateArgument>, clang::SourceLocation,
bool) (/usr/local/clang-trunk/bin/clang-3.9+0x2de008b)
#13 0x00000000028d188f clang::Parser::AnnotateTemplateIdTokenAsType()
(/usr/local/clang-trunk/bin/clang-3.9+0x28d188f)
#14 0x0000000002849646
clang::Parser::TryAnnotateTypeOrScopeTokenAfterScopeSpec(bool, bool,
clang::CXXScopeSpec&, bool) (/usr/local/clang-trunk/bin/clang-3.9+0x2849646)
#15 0x000000000284a043 clang::Parser::TryAnnotateName(bool,
std::unique_ptr<clang::CorrectionCandidateCallback,
std::default_delete<clang::CorrectionCandidateCallback> >)
(/usr/local/clang-trunk/bin/clang-3.9+0x284a043)
#16 0x00000000028c1e9d
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedContsructsKind, clang::SourceLocation*,
clang::Parser::ParsedAttributesWithRange&)
(/usr/local/clang-trunk/bin/clang-3.9+0x28c1e9d)
#17 0x00000000028c238e
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedContsructsKind, clang::SourceLocation*)
(/usr/local/clang-trunk/bin/clang-3.9+0x28c238e)
#18 0x00000000028c6be9 clang::Parser::ParseCompoundStatementBody(bool)
(/usr/local/clang-trunk/bin/clang-3.9+0x28c6be9)
#19 0x00000000028c9449 clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) (/usr/local/clang-trunk/bin/clang-3.9+0x28c9449)
#20 0x00000000028478bb
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*)
(/usr/local/clang-trunk/bin/clang-3.9+0x28478bb)
#21 0x000000000286782d clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
unsigned int, clang::SourceLocation*, clang::Parser::ForRangeInit*)
(/usr/local/clang-trunk/bin/clang-3.9+0x286782d)
#22 0x00000000028434dd
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/usr/local/clang-trunk/bin/clang-3.9+0x28434dd)
#23 0x0000000002843b81
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) [clone .part.222]
(/usr/local/clang-trunk/bin/clang-3.9+0x2843b81)
#24 0x0000000002843bbf
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
(/usr/local/clang-trunk/bin/clang-3.9+0x2843bbf)
#25 0x0000000002848a30
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (/usr/local/clang-trunk/bin/clang-3.9+0x2848a30)
#26 0x0000000002849200
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/usr/local/clang-trunk/bin/clang-3.9+0x2849200)
#27 0x000000000284082b clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-3.9+0x284082b)
#28 0x00000000024dd9fe clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-3.9+0x24dd9fe)
#29 0x00000000021e793e clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-3.9+0x21e793e)
#30 0x00000000021bcd06
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-3.9+0x21bcd06)
#31 0x0000000002276162
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-3.9+0x2276162)
#32 0x0000000000b0b938 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-3.9+0xb0b938)
#33 0x0000000000abb3ec main (/usr/local/clang-trunk/bin/clang-3.9+0xabb3ec)
#34 0x00007ff895411ec5 __libc_start_main
/build/eglibc-3GlaMS/eglibc-2.19/csu/libc-start.c:321:0
#35 0x0000000000b079a4 _start (/usr/local/clang-trunk/bin/clang-3.9+0xb079a4)
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
-coverage-file /data2/small.cpp -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++14 -fdeprecated-macro
-fdebug-compilation-dir /data2 -ferror-limit 19 -fmessage-length 177
-fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -o small.o -x c++ small.cpp
1.      small.cpp:6:3: at annotation token
2.      small.cpp:4:1: parsing function body 'main'
3.      small.cpp:4:1: in compound statement ('{}')
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 275012)
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-44c0fc.cpp
clang-3.9: note: diagnostic msg: /tmp/small-44c0fc.sh
clang-3.9: note: diagnostic msg:

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


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


#include <utility>

int main ()
{ 
  // should be: __make_integer_seq < std::integer_sequence, int, 10 > s;
  __make_integer_seq < __make_integer_seq, int, 10 > s;
  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/20160711/9a2e714a/attachment-0001.html>


More information about the llvm-bugs mailing list