-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Closed
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"clang:openmpOpenMP related changes to ClangOpenMP related changes to Clang
Description
Although the following test code satisfies the restrictions with respect to the usage of the scan directive in the spec, the compilation fails in the frontend.
template<typename T>
void exclusiveScan(const long N, std::vector<T> v) {
T scan_v{0};
#pragma omp parallel for reduction(inscan, +:scan_v)
for(int n = 0; n < N; ++n){
v[n] = scan_v;
#pragma omp scan exclusive(scan_v)
scan_v += v[n];
}
}However, the same test compiles successfully when a specific datatype like int or double is used.
The error log and stack trace:
clang++: /home/animkuma/llvm-project/llvm/include/llvm/Support/Casting.h:662: decltype(auto) llvm::dyn_cast(From*) [with To = clang::BinaryOperator; From = clang::Stmt]: Assertion `detail::isPresent(Val) && "dyn_cast on a non-existent value"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /home/animkuma/trunk_1.0/bin/clang++ -c scan.cpp -fopenmp -o scan.o
1. scan.cpp:13:1: current parser token '}'
2. scan.cpp:4:52: parsing function body 'exclusiveScan'
3. scan.cpp:4:52: in compound statement ('{}')
#0 0x00005579bd93483f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/animkuma/trunk_1.0/bin/clang+++0x278d83f)
#1 0x00005579bd9323bc llvm::sys::CleanupOnSignal(unsigned long) (/home/animkuma/trunk_1.0/bin/clang+++0x278b3bc)
#2 0x00005579bd876628 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x00007fe1e16b6420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#4 0x00007fe1e10aa00b raise /build/glibc-SzIz7B/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
#5 0x00007fe1e1089859 abort /build/glibc-SzIz7B/glibc-2.31/stdlib/abort.c:81:7
#6 0x00007fe1e1089729 get_sysdep_segment_value /build/glibc-SzIz7B/glibc-2.31/intl/loadmsgcat.c:509:8
#7 0x00007fe1e1089729 _nl_load_domain /build/glibc-SzIz7B/glibc-2.31/intl/loadmsgcat.c:970:34
#8 0x00007fe1e109afd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#9 0x00005579c039ec9c clang::StmtVisitorBase<std::add_pointer, (anonymous namespace)::EvaluatedExprMarker, void>::Visit(clang::Stmt*) SemaExpr.cpp:0:0
#10 0x00005579c039f24e clang::Sema::MarkDeclarationsReferencedInExpr(clang::Expr*, bool, llvm::ArrayRef<clang::Expr const*>) (/home/animkuma/trunk_1.0/bin/clang+++0x51f824e)
#11 0x00005579c062ea0f clang::Sema::ActOnOpenMPRegionEnd(clang::ActionResult<clang::Stmt*, true>, llvm::ArrayRef<clang::OMPClause*>) (/home/animkuma/trunk_1.0/bin/clang+++0x5487a0f)
#12 0x00005579bfebc483 clang::Parser::ParseOpenMPDeclarativeOrExecutableDirective(clang::Parser::ParsedStmtContext, bool) (/home/animkuma/trunk_1.0/bin/clang+++0x4d15483)
#13 0x00005579bfed9872 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) (/home/animkuma/trunk_1.0/bin/clang+++0x4d32872)
#14 0x00005579bfedb6df clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/home/animkuma/trunk_1.0/bin/clang+++0x4d346df)
#15 0x00005579bfedc6b9 clang::Parser::ParseCompoundStatementBody(bool) (/home/animkuma/trunk_1.0/bin/clang+++0x4d356b9)
#16 0x00005579bfede04a clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/home/animkuma/trunk_1.0/bin/clang+++0x4d3704a)
#17 0x00005579bfe079a1 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/home/animkuma/trunk_1.0/bin/clang+++0x4c609a1)
#18 0x00005579bfef8176 clang::Parser::ParseSingleDeclarationAfterTemplate(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/home/animkuma/trunk_1.0/bin/clang+++0x4d51176)
#19 0x00005579bfefd760 clang::Parser::ParseTemplateDeclarationOrSpecialization(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (.part.0) ParseTemplate.cpp:0:0
#20 0x00005579bfefda13 clang::Parser::ParseDeclarationStartingWithTemplate(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/home/animkuma/trunk_1.0/bin/clang+++0x4d56a13)
#21 0x00005579bfe37d9d clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (/home/animkuma/trunk_1.0/bin/clang+++0x4c90d9d)
#22 0x00005579bfe01ed4 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/home/animkuma/trunk_1.0/bin/clang+++0x4c5aed4)
#23 0x00005579bfe02e55 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/home/animkuma/trunk_1.0/bin/clang+++0x4c5be55)
#24 0x00005579bfdf6baa clang::ParseAST(clang::Sema&, bool, bool) (/home/animkuma/trunk_1.0/bin/clang+++0x4c4fbaa)
#25 0x00005579bebf00b8 clang::CodeGenAction::ExecuteAction() (/home/animkuma/trunk_1.0/bin/clang+++0x3a490b8)
#26 0x00005579be42af29 clang::FrontendAction::Execute() (/home/animkuma/trunk_1.0/bin/clang+++0x3283f29)
#27 0x00005579be3a9c2e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/animkuma/trunk_1.0/bin/clang+++0x3202c2e)
#28 0x00005579be50e9a6 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/animkuma/trunk_1.0/bin/clang+++0x33679a6)
#29 0x00005579bbf2a826 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/animkuma/trunk_1.0/bin/clang+++0xd83826)
#30 0x00005579bbf2242a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#31 0x00005579be201f8d void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#32 0x00005579bd876b30 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/home/animkuma/trunk_1.0/bin/clang+++0x26cfb30)
#33 0x00005579be2025af clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#34 0x00005579be1c92bc clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/home/animkuma/trunk_1.0/bin/clang+++0x30222bc)
#35 0x00005579be1c9d4d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/home/animkuma/trunk_1.0/bin/clang+++0x3022d4d)
#36 0x00005579be1d22e5 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/home/animkuma/trunk_1.0/bin/clang+++0x302b2e5)
#37 0x00005579bbf2809a clang_main(int, char**, llvm::ToolContext const&) (/home/animkuma/trunk_1.0/bin/clang+++0xd8109a)
#38 0x00005579bbe74c65 main (/home/animkuma/trunk_1.0/bin/clang+++0xccdc65)
#39 0x00007fe1e108b083 __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:342:3
#40 0x00005579bbf21eee _start (/home/animkuma/trunk_1.0/bin/clang+++0xd7aeee)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
clang version 18.0.0 (https://github.com/llvm/llvm-project.git 8cad4dd00077226f9fca5d176b7ef6ed9f668008)
Target: x86_64-unknown-linux-gnu
Thread model: posixPFA: Preprocessed source and run script.
scan-b0e5fd.zip
cc: @alexey-bataev
Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"clang:openmpOpenMP related changes to ClangOpenMP related changes to Clang