[llvm-bugs] [Bug 45102] New: Regression: FE crashes in clang::TypeVisitor::Visit()

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 4 09:57:17 PST 2020


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

            Bug ID: 45102
           Summary: Regression: FE crashes in clang::TypeVisitor::Visit()
           Product: clang
           Version: 10.0
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: xingxue at ca.ibm.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

Created attachment 23202
  --> https://bugs.llvm.org/attachment.cgi?id=23202&action=edit
diagnostic msg: t-797489.sh

The front-end crashes in clang::TypeVisitor::Visit() when compiling the
following small test case with CLANG 10.0.0 RC2 and the trunk.  CLANG 9.0.0 and
CLANG 9.0.1 compile it successfully so it is a regression.

The crash occurs with
https://github.com/llvm/llvm-project/commit/9dcfc7cd64abb301124cafaa95661b76a1fc5032
(the first buildable state after the culprit commit) and passes with a revert
of
https://github.com/llvm/llvm-project/commit/84959ae47f447fca9d56a9c61e8c46e993d0387a
(which landed while the build was broken).

Test case:
$ cat t.cpp
template <typename T> using Id = T;

template <typename T>
void g() {
  extern Id<void (T)> f;
  f(0);
}

int main(void) { g<int>(); }
$

Compiling with 9.0.1 passes:
$ /home/xingxue/install-9.0.1/bin/clang++ -std=c++11 -x c++ -c t.cpp
$

Compiling with 10.0.0.rc2 crashes:
$ /home/xingxue/install-10.0.0.rc2/bin/clang++ -std=c++11 -x c++ -c t.cpp
Stack dump:
0.      Program arguments: /home/xingxue/install-10.0.0.rc2/bin/clang++
-std=c++11 -x c++ -c t.cpp
1.      <eof> parser at end of file
2.      t.cpp:4:6: instantiating function definition 'g<int>'
 #0 0x0000000012083c14 PrintStackTraceSignalHandler(void*)
(/home/xingxue/install-10.0.0.rc2/bin/clang+++0x12083c14)
 #1 0x0000000012080e98 llvm::sys::RunSignalHandlers()
(/home/xingxue/install-10.0.0.rc2/bin/clang+++0x12080e98)
 #2 0x00000000120824f0 llvm::sys::CleanupOnSignal(unsigned long)
(/home/xingxue/install-10.0.0.rc2/bin/clang+++0x120824f0)
 #3 0x0000000011ff8618 CrashRecoverySignalHandler(int)
(/home/xingxue/install-10.0.0.rc2/bin/clang+++0x11ff8618)
 #4 0x00007197e59b04d8 (linux-vdso64.so.1+0x4d8)
 #5 0x0000000013e9d3d0 clang::TypeVisitor<(anonymous
namespace)::GetContainedInventedTypeParmVisitor,
clang::TemplateTypeParmDecl*>::Visit(clang::Type const*)
(/home/xingxue/install-10.0.0.rc2/bin/clang+++0x13e9d3d0)
 #6 0x0000000013e929bc clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformFunctionTypeParams(clang::SourceLocation,
llvm::ArrayRef<clang::ParmVarDecl*>, clang::QualType const*,
clang::FunctionType::ExtParameterInfo const*,
llvm::SmallVectorImpl<clang::QualType>&,
llvm::SmallVectorImpl<clang::ParmVarDecl*>*,
clang::Sema::ExtParameterInfoBuilder&)
(/home/xingxue/install-10.0.0.rc2/bin/clang+++0x13e929bc)
 #7 0x0000000013e92600 clang::Sema::SubstParmTypes(clang::SourceLocation,
llvm::ArrayRef<clang::ParmVarDecl*>, clang::FunctionType::ExtParameterInfo
const*, clang::MultiLevelTemplateArgumentList const&,
llvm::SmallVectorImpl<clang::QualType>&,
llvm::SmallVectorImpl<clang::ParmVarDecl*>*,
clang::Sema::ExtParameterInfoBuilder&)
(/home/xingxue/install-10.0.0.rc2/bin/clang+++0x13e92600)
 #8 0x0000000013ece29c
clang::TemplateDeclInstantiator::SubstFunctionType(clang::FunctionDecl*,
llvm::SmallVectorImpl<clang::ParmVarDecl*>&)
(/home/xingxue/install-10.0.0.rc2/bin/clang+++0x13ece29c)
 #9 0x0000000013ecc2c4
clang::TemplateDeclInstantiator::VisitFunctionDecl(clang::FunctionDecl*,
clang::TemplateParameterList*, clang::TemplateDeclInstantiator::RewriteKind)
(/home/xingxue/install-10.0.0.rc2/bin/clang+++0x13ecc2c4)
#10 0x0000000013ed3840
clang::TemplateDeclInstantiator::VisitFunctionDecl(clang::FunctionDecl*)
(/home/xingxue/install-10.0.0.rc2/bin/clang+++0x13ed3840)
#11 0x0000000013e94fb8 clang::declvisitor::Base<std::add_pointer,
clang::TemplateDeclInstantiator, clang::Decl*>::Visit(clang::Decl*)
(/home/xingxue/install-10.0.0.rc2/bin/clang+++0x13e94fb8)
#12 0x0000000013eda88c void llvm::function_ref<void
()>::callback_fn<clang::Sema::SubstDecl(clang::Decl*, clang::DeclContext*,
clang::MultiLevelTemplateArgumentList const&)::$_0>(long)
(/home/xingxue/install-10.0.0.rc2/bin/clang+++0x13eda88c)
#13 0x00000000138200e8
clang::Sema::runWithSufficientStackSpace(clang::SourceLocation,
llvm::function_ref<void ()>)
(/home/xingxue/install-10.0.0.rc2/bin/clang+++0x138200e8)
#14 0x0000000013ed4898 clang::Sema::SubstDecl(clang::Decl*,
clang::DeclContext*, clang::MultiLevelTemplateArgumentList const&)
(/home/xingxue/install-10.0.0.rc2/bin/clang+++0x13ed4898)
#15 0x0000000013eb6208 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformDeclStmt(clang::DeclStmt*)
(/home/xingxue/install-10.0.0.rc2/bin/clang+++0x13eb6208)
#16 0x0000000013eb0f30 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt*,
bool) (/home/xingxue/install-10.0.0.rc2/bin/clang+++0x13eb0f30)
#17 0x0000000013e97720 clang::Sema::SubstStmt(clang::Stmt*,
clang::MultiLevelTemplateArgumentList const&)
(/home/xingxue/install-10.0.0.rc2/bin/clang+++0x13e97720)
#18 0x0000000013ed69c0
clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool, bool)
(/home/xingxue/install-10.0.0.rc2/bin/clang+++0x13ed69c0)
#19 0x0000000013ed8ecc clang::Sema::PerformPendingInstantiations(bool)
(/home/xingxue/install-10.0.0.rc2/bin/clang+++0x13ed8ecc)
#20 0x000000001382298c
clang::Sema::ActOnEndOfTranslationUnitFragment(clang::Sema::TUFragmentKind)
(/home/xingxue/install-10.0.0.rc2/bin/clang+++0x1382298c)
#21 0x000000001382311c clang::Sema::ActOnEndOfTranslationUnit()
(/home/xingxue/install-10.0.0.rc2/bin/clang+++0x1382311c)
#22 0x000000001372c2c0
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
(/home/xingxue/install-10.0.0.rc2/bin/clang+++0x1372c2c0)
#23 0x00000000137268a0 clang::ParseAST(clang::Sema&, bool, bool)
(/home/xingxue/install-10.0.0.rc2/bin/clang+++0x137268a0)
#24 0x0000000012808c1c clang::ASTFrontendAction::ExecuteAction()
(/home/xingxue/install-10.0.0.rc2/bin/clang+++0x12808c1c)
#25 0x0000000012e0527c clang::CodeGenAction::ExecuteAction()
(/home/xingxue/install-10.0.0.rc2/bin/clang+++0x12e0527c)
#26 0x00000000128083f4 clang::FrontendAction::Execute()
(/home/xingxue/install-10.0.0.rc2/bin/clang+++0x128083f4)
#27 0x00000000127a8a6c
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/xingxue/install-10.0.0.rc2/bin/clang+++0x127a8a6c)
#28 0x00000000128c969c
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/xingxue/install-10.0.0.rc2/bin/clang+++0x128c969c)
#29 0x00000000104d0870 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/xingxue/install-10.0.0.rc2/bin/clang+++0x104d0870)
#30 0x00000000104cdf20 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
(/home/xingxue/install-10.0.0.rc2/bin/clang+++0x104cdf20)
#31 0x000000001267cb94 void llvm::function_ref<void
()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::string*, bool*) const::$_1>(long)
(/home/xingxue/install-10.0.0.rc2/bin/clang+++0x1267cb94)
#32 0x0000000011ff82a4
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
(/home/xingxue/install-10.0.0.rc2/bin/clang+++0x11ff82a4)
#33 0x000000001267bc98
clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::string*, bool*) const
(/home/xingxue/install-10.0.0.rc2/bin/clang+++0x1267bc98)
#34 0x000000001264d834
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const
(/home/xingxue/install-10.0.0.rc2/bin/clang+++0x1264d834)
#35 0x000000001264dd68
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const
(/home/xingxue/install-10.0.0.rc2/bin/clang+++0x1264dd68)
#36 0x0000000012662dd0
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&)
(/home/xingxue/install-10.0.0.rc2/bin/clang+++0x12662dd0)
#37 0x00000000104cd1ec main
(/home/xingxue/install-10.0.0.rc2/bin/clang+++0x104cd1ec)
#38 0x00007197e526441c generic_start_main
/build/glibc-uvws04/glibc-2.27/csu/../csu/libc-start.c:310:0
#39 0x00007197e5264618 __libc_start_main
/build/glibc-uvws04/glibc-2.27/csu/../sysdeps/unix/sysv/linux/powerpc/libc-start.c:116:0
clang-10: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 10.0.0
Target: powerpc64le-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/xingxue/install-10.0.0.rc2/bin
clang-10: note: diagnostic msg: PLEASE submit a bug report to
https://bugs.llvm.org/ and include the crash backtrace, preprocessed source,
and associated run script.
clang-10: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-10: note: diagnostic msg: /tmp/t-797489.cpp
clang-10: note: diagnostic msg: /tmp/t-797489.sh
clang-10: 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/20200304/e4a3cf47/attachment.html>


More information about the llvm-bugs mailing list