[llvm-bugs] [Bug 49894] New: Clang crash in SubstituteExplicitTemplateArguments

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Apr 8 09:51:08 PDT 2021


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

            Bug ID: 49894
           Summary: Clang crash in SubstituteExplicitTemplateArguments
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ebrown255 at gmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

Clang crashes in SubstituteExplicitTemplateArguments from this code:
https://godbolt.org/z/orbGf1ob7.

Possible duplicate of 48808.

Output:
<source>:19:80: error: expected ')'
void* f(/*typename*/ RefOrValueArg<std::is_scalar<K>::value>::template type<K>
key) {
                                                                              
^
<source>:19:8: note: to match this '('
void* f(/*typename*/ RefOrValueArg<std::is_scalar<K>::value>::template type<K>
key) {
       ^
<source>:19:84: error: expected ';' at end of declaration
void* f(/*typename*/ RefOrValueArg<std::is_scalar<K>::value>::template type<K>
key) {
                                                                               
   ^
                                                                               
   ;
<source>:19:85: error: expected unqualified-id
void* f(/*typename*/ RefOrValueArg<std::is_scalar<K>::value>::template type<K>
key) {
                                                                               
    ^
<source>:26:11: error: called object type 'void *' is not a function or
function pointer
  g(f<int>(a));
    ~~~~~~^
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: /opt/compiler-explorer/clang-trunk/bin/clang++ -g -o
/app/output.s -mllvm --x86-asm-syntax=intel -S
--gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics
-fno-crash-diagnostics <source>
1.      <eof> parser at end of file
2.      <source>:19:7: instantiating variable definition 'f<int>'
3.      <source>:19:7: instantiating variable definition 'f<int>'
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH
or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamEi+0x2c)[0x5597daa1183c]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN4llvm3sys17RunSignalHandlersEv+0x34)[0x5597daa0f7c4]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN4llvm3sys15CleanupOnSignalEm+0xb5)[0x5597daa0fa45]
/opt/compiler-explorer/clang-trunk/bin/clang++(+0x30bd968)[0x5597da973968]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x153c0)[0x7fe1c7ad73c0]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang4Sema35SubstituteExplicitTemplateArgumentsEPNS_20FunctionTemplateDeclERNS_24TemplateArgumentListInfoERN4llvm15SmallVectorImplINS_23DeducedTemplateArgumentEEERNS6_INS_8QualTypeEEEPSA_RNS_4sema21TemplateDeductionInfoE+0x41f)[0x5597dcde3dff]
/opt/compiler-explorer/clang-trunk/bin/clang++(+0x552e7d1)[0x5597dcde47d1]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang4Sema27runWithSufficientStackSpaceENS_14SourceLocationEN4llvm12function_refIFvvEEE+0x3f)[0x5597dc7a178f]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang4Sema23DeduceTemplateArgumentsEPNS_20FunctionTemplateDeclEPNS_24TemplateArgumentListInfoENS_8QualTypeERPNS_12FunctionDeclERNS_4sema21TemplateDeductionInfoEb+0x206)[0x5597dce16c86]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang4Sema23DeduceTemplateArgumentsEPNS_20FunctionTemplateDeclEPNS_24TemplateArgumentListInfoERPNS_12FunctionDeclERNS_4sema21TemplateDeductionInfoEb+0x17)[0x5597dce17267]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang4Sema43ResolveSingleFunctionTemplateSpecializationEPNS_12OverloadExprEbPNS_14DeclAccessPairE+0x2d5)[0x5597dccd8b65]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang4Sema34ResolveAddressOfOverloadedFunctionEPNS_4ExprENS_8QualTypeEbRNS_14DeclAccessPairEPb+0xcf5)[0x5597dccddfe5]
/opt/compiler-explorer/clang-trunk/bin/clang++(+0x54294ba)[0x5597dccdf4ba]
/opt/compiler-explorer/clang-trunk/bin/clang++(+0x5430227)[0x5597dcce6227]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang4Sema21TryImplicitConversionEPNS_4ExprENS_8QualTypeEbNS0_15AllowedExplicitEbbb+0x35)[0x5597dcce6475]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang22InitializationSequence14InitializeFromERNS_4SemaERKNS_17InitializedEntityERKNS_18InitializationKindEN4llvm15MutableArrayRefIPNS_4ExprEEEbb+0xd1f)[0x5597dcba6fcf]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang4Sema20AddInitializerToDeclEPNS_4DeclEPNS_4ExprEb+0xab5)[0x5597dc902205]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang4Sema30InstantiateVariableInitializerEPNS_7VarDeclES2_RKNS_30MultiLevelTemplateArgumentListE+0x2e0)[0x5597dce78050]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang4Sema37CompleteVarTemplateSpecializationDeclEPNS_29VarTemplateSpecializationDeclEPNS_7VarDeclERKNS_30MultiLevelTemplateArgumentListE+0x6b)[0x5597dce784cb]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang4Sema29InstantiateVariableDefinitionENS_14SourceLocationEPNS_7VarDeclEbbb+0x628)[0x5597dce842c8]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang4Sema28PerformPendingInstantiationsEb+0x219)[0x5597dce84b49]
/opt/compiler-explorer/clang-trunk/bin/clang++(+0x4f03609)[0x5597dc7b9609]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang4Sema25ActOnEndOfTranslationUnitEv+0xb5)[0x5597dc7b9d15]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang6Parser17ParseTopLevelDeclERNS_9OpaquePtrINS_12DeclGroupRefEEEb+0x362)[0x5597dc6a17f2]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang8ParseASTERNS_4SemaEbb+0x229)[0x5597dc694d59]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang13CodeGenAction13ExecuteActionEv+0x32)[0x5597db8b21c2]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang14FrontendAction7ExecuteEv+0xc1)[0x5597db29eea1]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang16CompilerInstance13ExecuteActionERNS_14FrontendActionE+0x153)[0x5597db23e233]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang25ExecuteCompilerInvocationEPNS_16CompilerInstanceE+0x813)[0x5597db367443]
/opt/compiler-explorer/clang-trunk/bin/clang++(_Z8cc1_mainN4llvm8ArrayRefIPKcEES2_Pv+0x119c)[0x5597d8945abc]
/opt/compiler-explorer/clang-trunk/bin/clang++(+0x108bbcd)[0x5597d8941bcd]
/opt/compiler-explorer/clang-trunk/bin/clang++(+0x383d975)[0x5597db0f3975]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN4llvm20CrashRecoveryContext9RunSafelyENS_12function_refIFvvEEE+0x23)[0x5597da973a43]
/opt/compiler-explorer/clang-trunk/bin/clang++(+0x383e2a8)[0x5597db0f42a8]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZNK5clang6driver11Compilation14ExecuteCommandERKNS0_7CommandERPS3_+0x9a)[0x5597db0cc3ea]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZNK5clang6driver11Compilation11ExecuteJobsERKNS0_7JobListERN4llvm15SmallVectorImplISt4pairIiPKNS0_7CommandEEEE+0x29f)[0x5597db0ccf3f]
/opt/compiler-explorer/clang-trunk/bin/clang++(_ZN5clang6driver6Driver18ExecuteCompilationERNS0_11CompilationERN4llvm15SmallVectorImplISt4pairIiPKNS0_7CommandEEEE+0xa5)[0x5597db0d5e55]
/opt/compiler-explorer/clang-trunk/bin/clang++(main+0x1814)[0x5597d885d9c4]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x7fe1c75880b3]
/opt/compiler-explorer/clang-trunk/bin/clang++(_start+0x2a)[0x5597d894172a]
clang-13: error: clang frontend command failed with exit code 139 (use -v to
see invocation)
Compiler returned: 139

-- 
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/20210408/adcc2ac7/attachment.html>


More information about the llvm-bugs mailing list