Issue |
142488
|
Summary |
[flang] Incorrect COMMON block storage sequence
|
Labels |
flang:frontend
|
Assignees |
|
Reporter |
DanielCChen
|
Consider the following code:
```
INTEGER i,j,k
INTEGER i7(10)
INTEGER i8(10)
INTEGER i9(20)
COMMON /BLOCK1/ i7,i8
EQUIVALENCE (i7,i9)
DO i = 1,20
i9(i) = i
END DO
FORALL ( i = 1:10 )
i8(i) = i9(9+i)
END FORALL
PRINT *,i8
PRINT *,i9
END
```
Expected output:
```
10 10 10 10 10 10 10 10 10 10
1 2 3 4 5 6 7 8 9 10 10 10 10 10 10 10 10 10 10 10
```
Flang outputs:
```
10 11 12 13 14 15 16 17 18 19
1 2 3 4 5 6 7 8 9 10 10 11 12 13 14 15 16 17 18 19
```
The standard requires the storage sequence of a COMMON block to be the order of its object list.
```
The order of the storage sequences is the same as the order of the appearance of the common block object lists in the scoping unit.
```
Therefore, the assignment to `i8` in `FORALL` should affect both `i8` and `i9`.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs