Issue 202354
Summary [flang][debug] line location set in the middle of the loop in array inlined array expressions causing breakpoints to fire too many times.
Labels flang
Assignees
Reporter jeanPerier
    Reported by @abidh in this [PR discussion](https://github.com/llvm/llvm-project/pull/197092#issuecomment-4615669711).

The issue is reproductible when reverting https://github.com/llvm/llvm-project/pull/201774 with flang -g -O0:

```
program broadcast
implicit none
integer :: arr(4)

arr = 11 ! line 5: scalar-to-array broadcast
print *, 'arr = ', arr ! line 6
end program broadcast
```

The break point on line 5 will fire 4 times (for each iteration of the array _expression_). This does not happens with other Fortran compiler that also inline the array _expression_ at O0, so something needs to be fixed around the line location for array expressions in flang.

Note that for a slightly different repro like below, the issue does not happen:
```
subroutine foo(x)
  integer :: x(100)
  x = 1
end subroutine

  integer :: x(100)
  call foo(x)
  print *, x(1), x(100)
end
```

This issue should be fixed so that https://github.com/llvm/llvm-project/pull/201774 can be reverted. All other compilers inline scalar to array assignment at O0.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to