Issue |
153031
|
Summary |
[flang] Incorrectly referenced function multiple times when it is used for array indexing.
|
Labels |
flang:frontend
|
Assignees |
|
Reporter |
DanielCChen
|
Consider the following reducer:
```
integer :: count = 0
type dt
integer, allocatable :: i(:)
end type
type(dt) :: x(10)
integer :: ub
allocate(x(2)%i(2:3))
ub = ubound(x(foo())%i,1) !! Called twice here.
if (count /= 7) error stop 5
contains
integer function foo()
foo = 2
count = count + 1
end function
end
```
Flang called function `foo` twice when it is referenced to get the array index for `x`. The `count` should be `1`.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs