[llvm-bugs] [Bug 51881] New: Crash on invalid use of `_Nonnull` attribute through an alias template

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Sep 16 11:11:20 PDT 2021


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

            Bug ID: 51881
           Summary: Crash on invalid use of `_Nonnull` attribute through
                    an alias template
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: chandlerc at gmail.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

https://compiler-explorer.com/z/EKfcebd97

```
template <typename T>
using Nonnull = T _Nonnull;

Nonnull<int> x;
```

>From compiler explorer:
```
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 -std=c++20 -O2 -march=haswell -fsanitize=null
-fno-inline <source>
1.      <source>:4:1: at annotation token
 #0 0x000055ebf938a22f PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
 #1 0x000055ebf93880f0 llvm::sys::CleanupOnSignal(unsigned long)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x35880f0)
 #2 0x000055ebf92d8a68 CrashRecoverySignalHandler(int)
CrashRecoveryContext.cpp:0:0
 #3 0x00007f02e24143c0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
 #4 0x000055ebfb934947 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformAttributedType(clang::TypeLocBuilder&,
clang::AttributedTypeLoc) SemaTemplateInstantiate.cpp:0:0
 #5 0x000055ebfb9242cb clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformType(clang::TypeLocBuilder&,
clang::TypeLoc) SemaTemplateInstantiate.cpp:0:0
 #6 0x000055ebfb927a2a clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformType(clang::TypeSourceInfo*)
SemaTemplateInstantiate.cpp:0:0
 #7 0x000055ebfb927b38 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformType(clang::QualType)
SemaTemplateInstantiate.cpp:0:0
 #8 0x000055ebfb92894c clang::Sema::SubstType(clang::QualType,
clang::MultiLevelTemplateArgumentList const&, clang::SourceLocation,
clang::DeclarationName)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x5b2894c)
 #9 0x000055ebfb841180 clang::Sema::CheckTemplateIdType(clang::TemplateName,
clang::SourceLocation, clang::TemplateArgumentListInfo&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x5a41180)
#10 0x000055ebfb842baf clang::Sema::ActOnTemplateIdType(clang::Scope*,
clang::CXXScopeSpec&, clang::SourceLocation,
clang::OpaquePtr<clang::TemplateName>, clang::IdentifierInfo*,
clang::SourceLocation, clang::SourceLocation,
llvm::MutableArrayRef<clang::ParsedTemplateArgument>, clang::SourceLocation,
bool, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5a42baf)
#11 0x000055ebfb21316d
clang::Parser::AnnotateTemplateIdTokenAsType(clang::CXXScopeSpec&, bool)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x541316d)
#12 0x000055ebfb17c3c2
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x537c3c2)
#13 0x000055ebfb1515af
clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x53515af)
#14 0x000055ebfb151e31
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) (.part.280) Parser.cpp:0:0
#15 0x000055ebfb157d59
clang::Parser::ParseExternalDeclaration(clang::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x5357d59)
#16 0x000055ebfb159179
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x5359179)
#17 0x000055ebfb14c9d9 clang::ParseAST(clang::Sema&, bool, bool)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x534c9d9)
#18 0x000055ebfa2fa762 clang::CodeGenAction::ExecuteAction()
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x44fa762)
#19 0x000055ebf9c985e1 clang::FrontendAction::Execute()
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x3e985e1)
#20 0x000055ebf9c35942
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x3e35942)
#21 0x000055ebf9d658e3
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x3f658e3)
#22 0x000055ebf70cf6dc cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x12cf6dc)
#23 0x000055ebf70cb75d ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
driver.cpp:0:0
#24 0x000055ebf9add095 void llvm::function_ref<void
()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#25 0x000055ebf92d9053
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x34d9053)
#26 0x000055ebf9adf14e
clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) const
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x3cdf14e)
#27 0x000055ebf9ab4b7a
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x3cb4b7a)
#28 0x000055ebf9ab56bf
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x3cb56bf)
#29 0x000055ebf9abeaf5
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x3cbeaf5)
#30 0x000055ebf6fdfb8e main
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x11dfb8e)
#31 0x00007f02e1ec40b3 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x270b3)
#32 0x000055ebf70cb2da _start
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x12cb2da)
clang-14: 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/20210916/e5258095/attachment-0001.html>


More information about the llvm-bugs mailing list