Issue |
131547
|
Summary |
[Flang] Compilation abnormally terminates when assigned GO TO statement is used
|
Labels |
flang
|
Assignees |
|
Reporter |
ohno-fj
|
```
Version of flang : 21.0.0(74ca5799caea342ac1e8d34ab5be7f45875131b2)/AArch64
```
According to `Fortran standard 2023: B. 1 Deleted features from Fortran 90`, `assigned GO TO statement` is `Deleted and obsolete features`.
However, flang mentions that it is supported by [Fortran Extensions supported by Flang](https://github.com/llvm/llvm-project/blob/main/flang/docs/Extensions.md).
```
Extensions, deletions, and legacy features supported by default
- ASSIGN statement, assigned GO TO, and assigned format
```
When the attached program is compiled and executed to confirm the above, `assignment GO TO statement` results in a compilation error.
Gfortran and ifx compile and execute normally.
The following are the test program, Flang, Gfortran and ifx compilation/execution result.
mvct1300_2.f:
```fortran
program main
real*4 a(11)/11*0/,b(10)/10*0/
do 100 i=1,10
b(i)=0
100 a(i)=0
do 110 i=2,10
j=i-1
if(j.gt.0) goto 120
111 continue
a(j)=j
120 j=j+1
assign 112 to label
if (j.lt.11) assign 111 to label
goto label (111,112)
112 b(i)=i
110 continue
write(6,*) a
write(6,*) b
stop
end
```
```
$ flang mvct1300_2.f
fatal Fortran runtime error(/work/home/ohno/CT/test/fort/tp/reproducerJ/mvct1/mvct1300_2.f:14): Assigned GOTO variable 'label' does not have a valid target label value
Aborted (core dumped)
$
```
```
$ gfortran mvct1300_2.f; ./a.out
mvct1300_2.f:5:72:
5 | 100 a(i)=0
| 1
Warning: Fortran 2018 deleted feature: DO termination statement which is not END DO or CONTINUE with label 100 at (1)
mvct1300_2.f:12:72:
12 | assign 112 to label
| 1
Warning: Deleted feature: ASSIGN statement at (1)
mvct1300_2.f:13:72:
13 | if (j.lt.11) assign 111 to label
| 1
Warning: Deleted feature: ASSIGN statement at (1)
mvct1300_2.f:14:21:
14 | goto label (111,112)
| 1
Warning: Deleted feature: Assigned GOTO statement at (1)
0.00000000 2.00000000 3.00000000 4.00000000 5.00000000 6.00000000 7.00000000 8.00000000 9.00000000 10.0000000 0.00000000
0.00000000 2.00000000 3.00000000 4.00000000 5.00000000 6.00000000 7.00000000 8.00000000 9.00000000 10.0000000
$
```
```
$ ifx mvct1300_2.f; ./a.out
0.0000000E+00 2.000000 3.000000 4.000000 5.000000
6.000000 7.000000 8.000000 9.000000 10.00000
0.0000000E+00
0.0000000E+00 2.000000 3.000000 4.000000 5.000000
6.000000 7.000000 8.000000 9.000000 10.00000
$
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs