Issue 242872
Summary [flang][OpenACC] `!$acc declare` in a subroutine with an ENTRY statement fails FIR verification: "null operand found"
Labels flang:fir-hlfir, openacc
Assignees
Reporter eugeneepshteyn
    Lowering fails verification when a subroutine that has an ENTRY statement contains a local `!$acc declare`:

```fortran
subroutine s
  real :: t(10)
  !$acc declare create(t)
  t = 1.0
entry e
end subroutine
```

```console
$ flang -fc1 -fopenacc -emit-hlfir repro.f90
error: loc("repro.f90":3:9): null operand found
error: verification of lowering to FIR failed
```

`flang -fopenacc -c repro.f90` reports the same error, and `-fsyntax-only` accepts the program. Without the `entry e` line, lowering succeeds and `s` gets the expected `acc.declare_enter` / `acc.declare_exit` pair. Adding SAVE to `t` does not change the failure.

Reproduced with flang built from main at fe077b6e4150de8d5712e7a6a6507bdd397a7877.

(This issue was filed with the help of AI)

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to