[llvm-bugs] [Bug 48808] New: Crash in SubstituteExplicitTemplateArguments when missing typename

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jan 19 14:55:19 PST 2021


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

            Bug ID: 48808
           Summary: Crash in SubstituteExplicitTemplateArguments when
                    missing typename
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: christopher.halse.rogers at canonical.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

Created attachment 24399
  --> https://bugs.llvm.org/attachment.cgi?id=24399&action=edit
Preprocessed source

Possible duplicate of 44616.

clang-test.cpp:14:42: error: expected ';' after expression
    /* typename */ T::template Alias<int> foo;
                                         ^
                                         ;
clang-test.cpp:14:43: error: use of undeclared identifier 'foo'; did you mean
'for'?
    /* typename */ T::template Alias<int> foo;
                                          ^~~
                                          for
clang-test.cpp:14:46: error: expected '(' after 'for'
    /* typename */ T::template Alias<int> foo;
                                             ^
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: /home/chris/.local/bin/clang-12 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-disable-llvm-verifier -discard-value-names -main-file-name clang-test.cpp
-mrelocation-model static -mframe-pointer=all -fmath-errno -fno-rounding-math
-mconstructor-aliases -munwind-tables -target-cpu x86-64 -tune-cpu generic
-fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir
/home/chris/.local/lib/clang/12.0.0 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/x86_64-linux-gnu/c++/10
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/x86_64-linux-gnu/c++/10
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/backward
-internal-isystem /usr/local/include -internal-isystem
/home/chris/.local/lib/clang/12.0.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -std=c++17 -fdeprecated-macro
-fdebug-compilation-dir /home/chris/Temp -ferror-limit 19 -fgnuc-version=4.2.1
-fcxx-exceptions -fexceptions -fcolor-diagnostics -faddrsig -o
/tmp/clang-test-d5e9dd.o -x c++ clang-test.cpp
1.      <eof> parser at end of file
2.      clang-test.cpp:13:6: instantiating function definition 'func<Derived>'
 #0 0x0000000004f5cc3c llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
(/home/chris/.local/bin/clang-12+0x4f5cc3c)
 #1 0x0000000004f5a4ee llvm::sys::RunSignalHandlers()
(/home/chris/.local/bin/clang-12+0x4f5a4ee)
 #2 0x0000000004f5d2bf SignalHandler(int)
(/home/chris/.local/bin/clang-12+0x4f5d2bf)
 #3 0x00007ff20d830bf0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x14bf0)
 #4 0x00000000074d0fb3
clang::Sema::SubstituteExplicitTemplateArguments(clang::FunctionTemplateDecl*,
clang::TemplateArgumentListInfo&,
llvm::SmallVectorImpl<clang::DeducedTemplateArgument>&,
llvm::SmallVectorImpl<clang::QualType>&, clang::QualType*,
clang::sema::TemplateDeductionInfo&)
(/home/chris/.local/bin/clang-12+0x74d0fb3)
 #5 0x00000000074d5dce
clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl*,
clang::TemplateArgumentListInfo*, clang::QualType, clang::FunctionDecl*&,
clang::sema::TemplateDeductionInfo&, bool)
(/home/chris/.local/bin/clang-12+0x74d5dce)
 #6 0x00000000073b9b3c
clang::Sema::ResolveSingleFunctionTemplateSpecialization(clang::OverloadExpr*,
bool, clang::DeclAccessPair*) (/home/chris/.local/bin/clang-12+0x73b9b3c)
 #7 0x00000000073ba187
clang::Sema::ResolveAndFixSingleFunctionTemplateSpecialization(clang::ActionResult<clang::Expr*,
true>&, bool, bool, clang::SourceRange, clang::QualType, unsigned int)
(/home/chris/.local/bin/clang-12+0x73ba187)
 #8 0x00000000070cef19 clang::Sema::CheckPlaceholderExpr(clang::Expr*)
(/home/chris/.local/bin/clang-12+0x70cef19)
 #9 0x00000000071e60f0 clang::Sema::ActOnFinishFullExpr(clang::Expr*,
clang::SourceLocation, bool, bool) (/home/chris/.local/bin/clang-12+0x71e60f0)
#10 0x000000000754e20c clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformStmt(clang::Stmt*,
clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::StmtDiscardKind)
(.llvm.12584484148662372181) (/home/chris/.local/bin/clang-12+0x754e20c)
#11 0x00000000075699c1 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt*,
bool) (/home/chris/.local/bin/clang-12+0x75699c1)
#12 0x0000000007593c67
clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool, bool)
(/home/chris/.local/bin/clang-12+0x7593c67)
#13 0x0000000007596d8b clang::Sema::PerformPendingInstantiations(bool)
(/home/chris/.local/bin/clang-12+0x7596d8b)
#14 0x0000000006d4cb53
clang::Sema::ActOnEndOfTranslationUnitFragment(clang::Sema::TUFragmentKind)
(/home/chris/.local/bin/clang-12+0x6d4cb53)
#15 0x0000000006d4d43d clang::Sema::ActOnEndOfTranslationUnit()
(/home/chris/.local/bin/clang-12+0x6d4d43d)
#16 0x0000000006c420aa
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
(/home/chris/.local/bin/clang-12+0x6c420aa)
#17 0x0000000006c3d69d clang::ParseAST(clang::Sema&, bool, bool)
(/home/chris/.local/bin/clang-12+0x6c3d69d)
#18 0x00000000059117c6 clang::FrontendAction::Execute()
(/home/chris/.local/bin/clang-12+0x59117c6)
#19 0x000000000585634d
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/chris/.local/bin/clang-12+0x585634d)
#20 0x00000000059e8b21
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/chris/.local/bin/clang-12+0x59e8b21)
#21 0x0000000002ec7a35 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/chris/.local/bin/clang-12+0x2ec7a35)
#22 0x0000000002ec5999 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
(/home/chris/.local/bin/clang-12+0x2ec5999)
#23 0x0000000002ec5148 main (/home/chris/.local/bin/clang-12+0x2ec5148)
#24 0x00007ff20d2b0cf2 __libc_start_main ./csu/../csu/libc-start.c:314:16
#25 0x0000000002ec1d6e _start (/home/chris/.local/bin/clang-12+0x2ec1d6e)
clang-12: error: unable to execute command: Segmentation fault (core dumped)
clang-12: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 12.0.0 (https://github.com/llvm/llvm-project.git
2d89ebd5d17b8d8800606880fe02cd867e4a0b90)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/chris/.local/bin
clang-12: note: diagnostic msg: 
********************

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

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

-- 
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/20210119/7f53ed26/attachment-0001.html>


More information about the llvm-bugs mailing list