llvm icon indicating copy to clipboard operation
llvm copied to clipboard

Clang crash from properties constructor changes

Open steffenlarsen opened this issue 9 months ago • 0 comments

Describe the bug

Following the changes in https://github.com/intel/llvm/pull/13676, constructors with repeat property values causes a crash in the clang frontend with:

--
# RUN: at line 1
.../llvm-release/bin/clang --driver-mode=g++  -fsycl -fsycl-targets=spir64-unknown-unknown -fsyntax-only -ferror-limit=0 -Xclang -verify -Xclang -verify-ignore-unexpected=note,warning .../llvm/sycl/test/extensions/properties/properties_ctor_negative.cpp
# executed command: .../llvm-release/bin/clang --driver-mode=g++ -fsycl -fsycl-targets=spir64-unknown-unknown -fsyntax-only -ferror-limit=0 -Xclang -verify -Xclang -verify-ignore-unexpected=note,warning .../llvm/sycl/test/extensions/properties/properties_ctor_negative.cpp
# .---command stderr------------
# | clang-19: .../llvm/clang/lib/Sema/SemaExprMember.cpp:993: clang::ExprResult clang::Sema::BuildMemberReferenceExpr(clang::Expr*, clang::QualType, clang::SourceLocation, bool, const clang::CXXScopeSpec&, clang::SourceLocation, clang::NamedDecl*, clang::LookupResult&, const clang::TemplateArgumentListInfo*, const clang::Scope*, bool, clang::Sema::ActOnMemberAccessExtraArgs*): Assertion `!SS.isInvalid() && "nested-name-specifier cannot be invalid"' failed.
# | PLEASE submit a bug report to https://github.com/intel/llvm/issues and include the crash backtrace, preprocessed source, and associated run script.
# | Stack dump:
# | 0.	Program arguments: .../llvm-release/bin/clang-19 -cc1 -triple spir64-unknown-unknown -aux-triple x86_64-unknown-linux-gnu -fsycl-is-device -fdeclare-spirv-builtins -mllvm -sycl-opt -fenable-sycl-dae -fsycl-instrument-device-code -Wno-sycl-strict -O2 -fsycl-int-header=/tmp/lit-tmp-6i4ce0f4/properties_ctor_negative-header-0a4029.h -fsycl-int-footer=/tmp/lit-tmp-6i4ce0f4/properties_ctor_negative-footer-b83f96.h -sycl-std=2020 -ffine-grained-bitfield-accesses -fsycl-unique-prefix=uidb5e0744c1b9e468d -D__SYCL_ANY_DEVICE_HAS_ANY_ASPECT__=1 -Wspir-compat -fsyntax-only -disable-free -clear-ast-before-backend -main-file-name properties_ctor_negative.cpp -fsycl-use-main-file-name -full-main-file-name .../llvm/sycl/test/extensions/properties/properties_ctor_negative.cpp -mrelocation-model static -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -aux-target-cpu x86-64 -debugger-tuning=gdb -fdebug-compilation-dir=.../llvm-release/tools/sycl/test/extensions/properties -fcoverage-compilation-dir=.../llvm-release/tools/sycl/test/extensions/properties -resource-dir .../llvm-release/lib/clang/19 -internal-isystem .../llvm-release/bin/../include/sycl -internal-isystem .../llvm-release/bin/../include/sycl/stl_wrappers -internal-isystem .../llvm-release/bin/../include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/x86_64-linux-gnu/c++/12 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/backward -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/x86_64-linux-gnu/c++/12 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/backward -internal-isystem .../llvm-release/lib/clang/19/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -internal-isystem .../llvm-release/lib/clang/19/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -std=c++17 -fdeprecated-macro -ferror-limit 0 -fgpu-rdc -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -verify -verify-ignore-unexpected=note,warning -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -x c++ .../llvm/sycl/test/extensions/properties/properties_ctor_negative.cpp
# | 1.	.../llvm/sycl/test/extensions/properties/properties_ctor_negative.cpp:40:47: current parser token ';'
# | 2.	.../llvm/sycl/test/extensions/properties/properties_ctor_negative.cpp:7:12: parsing function body 'main'
# | 3.	.../llvm/sycl/test/extensions/properties/properties_ctor_negative.cpp:7:12: in compound statement ('{}')
# | 4.	.../llvm-release/bin/../include/sycl/ext/oneapi/properties/properties.hpp:172:13: instantiating function definition 'sycl::_V1::ext::oneapi::experimental::properties<std::tuple<sycl::ext::oneapi::experimental::foo>>::properties<sycl::ext::oneapi::experimental::foo, sycl::ext::oneapi::experimental::foo, 0>'
# | 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):
# | 0  clang-19  0x000056426e1a6bd0 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 240
# | 1  clang-19  0x000056426e1a3fdf llvm::sys::RunSignalHandlers() + 47
# | 2  clang-19  0x000056426e1a4135
# | 3  libc.so.6 0x00007f7d60a31520
# | 4  libc.so.6 0x00007f7d60a859fc pthread_kill + 300
# | 5  libc.so.6 0x00007f7d60a31476 raise + 22
# | 6  libc.so.6 0x00007f7d60a177f3 abort + 211
# | 7  libc.so.6 0x00007f7d60a1771b
# | 8  libc.so.6 0x00007f7d60a28e96
# | 9  clang-19  0x0000564270f6185a clang::Sema::BuildMemberReferenceExpr(clang::Expr*, clang::QualType, clang::SourceLocation, bool, clang::CXXScopeSpec const&, clang::SourceLocation, clang::NamedDecl*, clang::LookupResult&, clang::TemplateArgumentListInfo const*, clang::Scope const*, bool, clang::Sema::ActOnMemberAccessExtraArgs*) + 794
# | 10 clang-19  0x0000564270f62bc3 clang::Sema::BuildMemberReferenceExpr(clang::Expr*, clang::QualType, clang::SourceLocation, bool, clang::CXXScopeSpec&, clang::SourceLocation, clang::NamedDecl*, clang::DeclarationNameInfo const&, clang::TemplateArgumentListInfo const*, clang::Scope const*, clang::Sema::ActOnMemberAccessExtraArgs*) + 483
# | 11 clang-19  0x00005642714cf4e0
# | 12 clang-19  0x0000564271498f55 clang::Sema::SubstInitializer(clang::Expr*, clang::MultiLevelTemplateArgumentList const&, bool) + 117
# | 13 clang-19  0x00005642714e7790 clang::Sema::InstantiateVariableInitializer(clang::VarDecl*, clang::VarDecl*, clang::MultiLevelTemplateArgumentList const&) + 400
# | 14 clang-19  0x0000564271533070 clang::Sema::BuildVariableInstantiation(clang::VarDecl*, clang::VarDecl*, clang::MultiLevelTemplateArgumentList const&, llvm::SmallVector<clang::Sema::LateInstantiatedAttribute, 16u>*, clang::DeclContext*, clang::LocalInstantiationScope*, bool, clang::VarTemplateSpecializationDecl*) + 1264
# | 15 clang-19  0x000056427153f290 clang::TemplateDeclInstantiator::VisitVarDecl(clang::VarDecl*, bool, llvm::ArrayRef<clang::BindingDecl*>*) + 496
# | 16 clang-19  0x0000564271544c38
# | 17 clang-19  0x000056427095cae5 clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) + 69
# | 18 clang-19  0x00005642714e5891 clang::Sema::SubstDecl(clang::Decl*, clang::DeclContext*, clang::MultiLevelTemplateArgumentList const&) + 225
# | 19 clang-19  0x000056427148ca01
# | 20 clang-19  0x00005642714d4148
# | 21 clang-19  0x00005642714dc22e clang::Sema::SubstStmt(clang::Stmt*, clang::MultiLevelTemplateArgumentList const&) + 110
# | 22 clang-19  0x00005642715378af clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool, bool) + 4351
# | 23 clang-19  0x000056427095cae5 clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) + 69
# | 24 clang-19  0x0000564270db8f5f clang::Sema::MarkFunctionReferenced(clang::SourceLocation, clang::FunctionDecl*, bool) + 1423
# | 25 clang-19  0x0000564270c4c9dc clang::Sema::BuildCXXConstructExpr(clang::SourceLocation, clang::QualType, clang::CXXConstructorDecl*, bool, llvm::MutableArrayRef<clang::Expr*>, bool, bool, bool, bool, clang::CXXConstructionKind, clang::SourceRange) + 348
# | 26 clang-19  0x0000564270cd7b46 clang::Sema::BuildCXXConstructExpr(clang::SourceLocation, clang::QualType, clang::NamedDecl*, clang::CXXConstructorDecl*, llvm::MutableArrayRef<clang::Expr*>, bool, bool, bool, bool, clang::CXXConstructionKind, clang::SourceRange) + 390
# | 27 clang-19  0x0000564270f92da0
# | 28 clang-19  0x0000564270fa6d73 clang::InitializationSequence::Perform(clang::Sema&, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::MutableArrayRef<clang::Expr*>, clang::QualType*) + 7235
# | 29 clang-19  0x0000564270b847d2 clang::Sema::AddInitializerToDecl(clang::Decl*, clang::Expr*, bool) + 2562
# | 30 clang-19  0x0000564270822a69 clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*) + 1193
# | 31 clang-19  0x0000564270838780 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo&, clang::SourceLocation*, clang::Parser::ForRangeInit*) + 2608
# | 32 clang-19  0x0000564270839da6 clang::Parser::ParseSimpleDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, bool, clang::Parser::ForRangeInit*, clang::SourceLocation*) + 870
# | 33 clang-19  0x000056427083a2a3 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) + 291
# | 34 clang-19  0x00005642708e098b clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) + 3435
# | 35 clang-19  0x00005642708e17f7 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) + 327
# | 36 clang-19  0x00005642708e26d1 clang::Parser::ParseCompoundStatementBody(bool) + 1537
# | 37 clang-19  0x00005642708e599f clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) + 207
# | 38 clang-19  0x00005642707f3b76 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) + 3254
# | 39 clang-19  0x0000564270838f83 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo&, clang::SourceLocation*, clang::Parser::ForRangeInit*) + 4659
# | 40 clang-19  0x00005642707ee7ec clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) + 780
# | 41 clang-19  0x00005642707eefc0 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) + 912
# | 42 clang-19  0x00005642707f78e6 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) + 758
# | 43 clang-19  0x00005642707f88d5 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) + 597
# | 44 clang-19  0x00005642707e84fa clang::ParseAST(clang::Sema&, bool, bool) + 602
# | 45 clang-19  0x000056426ed6da19 clang::FrontendAction::Execute() + 201
# | 46 clang-19  0x000056426eced3c5 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 1173
# | 47 clang-19  0x000056426ee46205 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 421
# | 48 clang-19  0x000056426cd683ef cc1_main(llvm::ArrayRef<char const*>, char const*, void*) + 6431
# | 49 clang-19  0x000056426cd618e3
# | 50 clang-19  0x000056426cd6482f clang_main(int, char**, llvm::ToolContext const&) + 4495
# | 51 clang-19  0x000056426cc9f04b main + 107
# | 52 libc.so.6 0x00007f7d60a18d90
# | 53 libc.so.6 0x00007f7d60a18e40 __libc_start_main + 128
# | 54 clang-19  0x000056426cd60b95 _start + 37
# | clang: error: unable to execute command: Aborted (core dumped)
# | clang: error: clang frontend command failed due to signal (use -v to see invocation)
# | clang version 19.0.0git (https://github.com/steffenlarsen/llvm.git 1e43b79a97093ace7222ee8658e9955b72def801)
# | Target: x86_64-unknown-linux-gnu
# | Thread model: posix
# | InstalledDir: .../llvm-release/bin
# | Build config: +assertions
# | clang: note: diagnostic msg: Error generating preprocessed source(s).
# `-----------------------------
# error: command failed with exit status: 1

--

This can be reproduced by removing the comments in /iusers/steffenl/llvm/sycl/test/extensions/properties/properties_ctor_negative.cpp and running check-sycl.

To reproduce

No response

Environment

No response

Additional context

No response

steffenlarsen avatar May 07 '24 05:05 steffenlarsen