Issue 178791
Summary [Flang] Incorrect execution result when the array described in scalar-mask-expr within do concurrent construct is redefined in do concurrent loop during execution
Labels flang
Assignees
Reporter ohno-fj
    ```
Version of flang : 23.0.0(e5d235831dfb07b6e767812af7f9d3daa5896f78)/AArch64
```

In the attached program (`snggu828_22.f90`), the array (`mask`) exists in the following locations:
(1) `scalar-mask-expr` within `do concurrent construct`
(2) the assignment statement within `do concurrent` loop

The array (`mask`) is redefined within (2). This redefined value is reflected in `scalar-mask-expr` in (1). Therefore, the execution results appear to be incorrect.
The execution result I expect is the same as that of gfortran.

The following are the test program, Flang, Gfortran and ifx compilation/execution results.

snggu828_22.f90:
```fortran
program main
  implicit none
  integer(8)::i
  integer*8 ::a(10)=0
  integer*8 b(10)/10*2/
  integer*4:: mask(10)=0
  do concurrent(i=1:9,mask(i)==0)
 a(i) = b(i) + 3
     mask(i+1) =  1
  end do
  write(6,*) "a    = ", a
  write(6,*) "mask = ", mask
end program main
```

```
$ flang snggu828_22.f90; ./a.out
 a    =  5 0 5 0 5 0 5 0 5 0
 mask =  0 1 0 1 0 1 0 1 0 1
$
```

```
$ gfortran snggu828_22.f90; ./a.out
 a    = 5                    5                    5                    5 5                    5                    5 5                    5                    0
 mask =            0 1           1           1           1           1           1           1 1           1
$
```

```
$ ifx snggu828_22.f90; ./a.out
 a    = 5                     0                     5
 0                     5                     0
 5                     0                     5
                     0
 mask =            0           1           0           1           0           1
 0           1           0           1
$
```

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

Reply via email to