Skip to content

acc wait copy(x) causes fatal internal error: CHECK(!dirContext_.empty()) #140281

Open
@erichkeane

Description

@erichkeane

See this reproducer:

! Type your code here, or load an example.
integer function square(x)
    implicit none
    integer, intent(in) :: x

!$acc wait copy(x)
    square = x * x
end function square

fatal internal error: CHECK(!dirContext_.empty()) failed at /root/llvm-project/flang/lib/Semantics/resolve-directives.cpp(60)
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /opt/compiler-explorer/clang-llvmflang-trunk/bin/flang -fc1 -fopenacc -emit-fir -o /app/output.s <source>
 #0 0x0000000003e3ce98 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-llvmflang-trunk/bin/flang+0x3e3ce98)
 #1 0x0000000003e3aa54 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #2 0x00007f8f50c42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x00007f8f50c969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #4 0x00007f8f50c42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #5 0x00007f8f50c287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #6 0x0000000005b2c0b9 (/opt/compiler-explorer/clang-llvmflang-trunk/bin/flang+0x5b2c0b9)
 #7 0x0000000004c9fe7d Fortran::semantics::AccAttributeVisitor::ResolveAccObjectList(Fortran::parser::AccObjectList const&, Fortran::semantics::Symbol::Flag) (/opt/compiler-explorer/clang-llvmflang-trunk/bin/flang+0x4c9fe7d)
 #8 0x0000000004cb7733 void Fortran::parser::detail::ParseTreeVisitorLookupScope::Walk<Fortran::parser::AccClause, Fortran::semantics::AccAttributeVisitor>(std::__cxx11::list<Fortran::parser::AccClause, std::allocator<Fortran::parser::AccClause>> const&, Fortran::semantics::AccAttributeVisitor&) (/opt/compiler-explorer/clang-llvmflang-trunk/bin/flang+0x4cb7733)
 #9 0x0000000004cd37d6 void Fortran::parser::detail::ParseTreeVisitorLookupScope::Walk<Fortran::semantics::AccAttributeVisitor>(std::__cxx11::list<Fortran::parser::ExecutionPartConstruct, std::allocator<Fortran::parser::ExecutionPartConstruct>> const&, Fortran::semantics::AccAttributeVisitor&) (/opt/compiler-explorer/clang-llvmflang-trunk/bin/flang+0x4cd37d6)
#10 0x0000000004cd65b8 void Fortran::parser::detail::ParseTreeVisitorLookupScope::Walk<Fortran::semantics::AccAttributeVisitor, Fortran::parser::Statement<Fortran::parser::FunctionStmt>, Fortran::parser::SpecificationPart, Fortran::parser::ExecutionPart, std::optional<Fortran::parser::InternalSubprogramPart>, Fortran::parser::Statement<Fortran::parser::EndFunctionStmt>>(std::tuple<Fortran::parser::Statement<Fortran::parser::FunctionStmt>, Fortran::parser::SpecificationPart, Fortran::parser::ExecutionPart, std::optional<Fortran::parser::InternalSubprogramPart>, Fortran::parser::Statement<Fortran::parser::EndFunctionStmt>> const&, Fortran::semantics::AccAttributeVisitor&) (/opt/compiler-explorer/clang-llvmflang-trunk/bin/flang+0x4cd65b8)
#11 0x0000000004cd72b0 Fortran::semantics::ResolveAccParts(Fortran::semantics::SemanticsContext&, Fortran::parser::ProgramUnit const&, Fortran::semantics::Scope*) (/opt/compiler-explorer/clang-llvmflang-trunk/bin/flang+0x4cd72b0)
#12 0x00000000049421db Fortran::semantics::ResolveNamesVisitor::Pre(Fortran::parser::ProgramUnit const&) (/opt/compiler-explorer/clang-llvmflang-trunk/bin/flang+0x49421db)
#13 0x0000000004943731 Fortran::semantics::ResolveNames(Fortran::semantics::SemanticsContext&, Fortran::parser::Program const&, Fortran::semantics::Scope&) (/opt/compiler-explorer/clang-llvmflang-trunk/bin/flang+0x4943731)
#14 0x00000000049b0e86 Fortran::semantics::Semantics::Perform() (/opt/compiler-explorer/clang-llvmflang-trunk/bin/flang+0x49b0e86)
#15 0x0000000003e95998 Fortran::frontend::FrontendAction::runSemanticChecks() (/opt/compiler-explorer/clang-llvmflang-trunk/bin/flang+0x3e95998)
#16 0x0000000004146be0 Fortran::frontend::CodeGenAction::beginSourceFileAction() (/opt/compiler-explorer/clang-llvmflang-trunk/bin/flang+0x4146be0)
#17 0x0000000003e945d5 Fortran::frontend::FrontendAction::beginSourceFile(Fortran::frontend::CompilerInstance&, Fortran::frontend::FrontendInputFile const&) (/opt/compiler-explorer/clang-llvmflang-trunk/bin/flang+0x3e945d5)
#18 0x0000000003e830d7 Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&) (/opt/compiler-explorer/clang-llvmflang-trunk/bin/flang+0x3e830d7)
#19 0x0000000003e9e433 Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) (/opt/compiler-explorer/clang-llvmflang-trunk/bin/flang+0x3e9e433)
#20 0x00000000021b50ae fc1_main(llvm::ArrayRef<char const*>, char const*) (/opt/compiler-explorer/clang-llvmflang-trunk/bin/flang+0x21b50ae)
#21 0x000000000206c80f main (/opt/compiler-explorer/clang-llvmflang-trunk/bin/flang+0x206c80f)
#22 0x00007f8f50c29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#23 0x00007f8f50c29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#24 0x00000000021b39d5 _start (/opt/compiler-explorer/clang-llvmflang-trunk/bin/flang+0x21b39d5)
Program terminated with signal: SIGSEGV
Compiler returned: 139

https://godbolt.org/z/z8Wr7o8vj

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions