Issue 135964
Summary [Flang][OpenACC] Flang asserts when using `routine`
Labels flang
Assignees
Reporter erichkeane
    see: 
https://godbolt.org/z/bhaaxPcn9

```
! Type your code here, or load an example.

integer function square(x)
    implicit none
    integer, intent(in) :: x

    square = x * x
end function square

!$acc routine(square) bind(asdf) 
```

This is something that is supposed to be valid AFAIK, but Fortran asserts:
```
fatal internal error: CHECK(parent_ != this) failed at /root/llvm-project/flang/include/flang/Semantics/scope.h(82)
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 0x0000000003da79b8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-llvmflang-trunk/bin/flang+0x3da79b8)
 #1 0x0000000003da5574 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #2 0x00007508a0242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x00007508a02969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #4 0x00007508a0242476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #5 0x00007508a02287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #6 0x0000000005a8f0d9 (/opt/compiler-explorer/clang-llvmflang-trunk/bin/flang+0x5a8f0d9)
 #7 0x0000000004c00e6a (/opt/compiler-explorer/clang-llvmflang-trunk/bin/flang+0x4c00e6a)
 #8 0x0000000004c0a34c Fortran::semantics::AccAttributeVisitor::AddRoutineInfoToSymbol(Fortran::semantics::Symbol&, Fortran::parser::OpenACCRoutineConstruct const&) (.part.0) resolve-directives.cpp:0:0
 #9 0x0000000004c0a7a7 Fortran::semantics::AccAttributeVisitor::Pre(Fortran::parser::OpenACCRoutineConstruct const&) (/opt/compiler-explorer/clang-llvmflang-trunk/bin/flang+0x4c0a7a7)
#10 0x0000000004c395a1 Fortran::semantics::ResolveAccParts(Fortran::semantics::SemanticsContext&, Fortran::parser::ProgramUnit const&, Fortran::semantics::Scope*) (/opt/compiler-explorer/clang-llvmflang-trunk/bin/flang+0x4c395a1)
#11 0x00000000048a8d97 Fortran::semantics::ResolveNamesVisitor::Pre(Fortran::parser::ProgramUnit const&) (/opt/compiler-explorer/clang-llvmflang-trunk/bin/flang+0x48a8d97)
#12 0x00000000048aa271 Fortran::semantics::ResolveNames(Fortran::semantics::SemanticsContext&, Fortran::parser::Program const&, Fortran::semantics::Scope&) (/opt/compiler-explorer/clang-llvmflang-trunk/bin/flang+0x48aa271)
#13 0x0000000004914956 Fortran::semantics::Semantics::Perform() (/opt/compiler-explorer/clang-llvmflang-trunk/bin/flang+0x4914956)
#14 0x0000000003dffead Fortran::frontend::FrontendAction::runSemanticChecks() (/opt/compiler-explorer/clang-llvmflang-trunk/bin/flang+0x3dffead)
#15 0x00000000040ae190 Fortran::frontend::CodeGenAction::beginSourceFileAction() (/opt/compiler-explorer/clang-llvmflang-trunk/bin/flang+0x40ae190)
#16 0x0000000003dfeb55 Fortran::frontend::FrontendAction::beginSourceFile(Fortran::frontend::CompilerInstance&, Fortran::frontend::FrontendInputFile const&) (/opt/compiler-explorer/clang-llvmflang-trunk/bin/flang+0x3dfeb55)
#17 0x0000000003ded617 Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&) (/opt/compiler-explorer/clang-llvmflang-trunk/bin/flang+0x3ded617)
#18 0x0000000003e08943 Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) (/opt/compiler-explorer/clang-llvmflang-trunk/bin/flang+0x3e08943)
#19 0x000000000218375e fc1_main(llvm::ArrayRef<char const*>, char const*) (/opt/compiler-explorer/clang-llvmflang-trunk/bin/flang+0x218375e)
#20 0x000000000204cf5f main (/opt/compiler-explorer/clang-llvmflang-trunk/bin/flang+0x204cf5f)
#21 0x00007508a0229d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#22 0x00007508a0229e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#23 0x0000000002182085 _start (/opt/compiler-explorer/clang-llvmflang-trunk/bin/flang+0x2182085)
Program terminated with signal: SIGSEGV
Compiler returned: 139
```

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to