Issue 135578
Summary [Flang] Execution does not terminate when an array name enclosed in square brackets is used in where construct
Labels flang
Assignees
Reporter ohno-fj
    ```
Version of flang : 21.0.0(9fe6f6a0d430b872750354c20f3e4a651bd1f135)/AArch64
```

When `array-constructor (an array name enclosed in square brackets)` is used in `where construct`, execution does not terminate after more than 20 minutes. 
Gfortran and ifx execute in less than a second.  
The above program is sngtar12_2.f90

According to the `Fortran standard 2023: 7.8 Construction of array values`, it seems correct to use array names enclosed in `square brackets`.

Execution terminates in the following cases:
 - Do not use where construct  
   The above program is sngtar12_21.f90
 - Do not use square brackets  
   The above program is sngtar12_23.f90

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

sngtar12_2.f90:
```fortran
program main
  integer a(6000*400), b(6000*400)
  a=1
  where(a>0)
     b=[a]
     b=[a**1]
  end where
 if(b(6000*400)/=1) print *,'err1'
  print *,'pass'
end program
```

```
$ flang sngtar12_2.f90; time ./a.out -> Killed because execution does not terminate after more than 20 minutes
  C-c C-c
real 24m34.953s
user    24m9.212s
sys     0m25.710s

$
```

```
$ gfortran sngtar12_2.f90; time ./a.out
 pass

real    0m0.056s
user 0m0.033s
sys     0m0.023s
$
```

```
$ ifx sngtar12_2.f90; time ./a.out
 pass

real    0m0.255s
user    0m0.002s
sys 0m0.005s
$
```

sngtar12_21.f90:
```fortran
program main
  integer a(6000*400), b(6000*400)
  a=1
!  where(a>0)
     b=[a]
     b=[a**1]
! end where
  if(b(6000*400)/=1) print *,'err1'
  print *,'pass'
end program
```

```
$ flang sngtar12_21.f90; time ./a.out
 pass

real 0m0.146s
user    0m0.128s
sys 0m0.011s
$
```

sngtar12_23.f90:
```fortran
program main
  integer a(6000*400), b(6000*400)
  a=1
  where(a>0)
     b=a
     b=a**1
  end where
  if(b(6000*400)/=1) print *,'err1'
  print *,'pass'
end program
```

```
$ flang sngtar12_23.f90; time ./a.out
 pass

real 0m0.240s
user    0m0.185s
sys     0m0.001s
$
```


_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to