<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/65036>65036</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang] Compilation error when jumping out of the DO construct and into another
</td>
</tr>
<tr>
<th>Labels</th>
<td>
flang:frontend
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ohno-fj
</td>
</tr>
</table>
<pre>
```
Version of flang-new : 18.0.0(c07062a2e9bf9aa1211b958f6bb4c5746139c180)
```
A program that jump out of a DO construct with a GOTO statement and jump into another DO construct has a warning message output by Flang-new, Gfortran and ifort.
However, only Flang-new subsequently causes a compilation error.
The following are the test program, Flang-new, Gfortran and ifort compilation result.
cvct4213.cmp_3.f:
```fortran
PROGRAM CV4213
INTEGER LOOP
INTEGER J
REAL*4 EV10(10)
DATA EV10/0,3*1,5*-2.5,0/
REAL*8 DV20(200)
DATA (DV20(I), I=1,200,2)/1,2,30*5,0,36*4,-1,30*-3/
DATA (DV20(I), I=2,200,2)/1,2,0,28*5,36*4,-1,32*-3/
INTEGER I1
J = 10
LOOP = 1
DO I1=1,10
IF (EV10(J) .EQ. 0) GO TO 29
J = J - 1
END DO
19 WRITE (6, *) 'loop'
LOOP = 2
DO J=1,2
DO I1=2,200,2
IF (DV20(I1) .LE. 0) THEN
GO TO 29
END IF
END DO
29 CONTINUE
GO TO (19), LOOP
END DO
END
```
```
$ flang-new cvct4213.cmp_3.f
./cvct4213.cmp_3.f:13:9: warning: Label '29' is in a construct that should not be used as a branch target here
IF (EV10(J) .EQ. 0) GO TO 29
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: loc("/home/ohno/tp/reproducerJ/Metro/cvct_fomp/cvct4213.cmp_3.f":25:9): operand #1 does not dominate this use
error: verification of lowering to FIR failed
$
```
```
$ gfortran cvct4213.cmp_3.f
cvct4213.cmp_3.f:24:5:
cvct4213.cmp_3.f:13:72:
IF (EV10(J) .EQ. 0) GO TO 29
2
cvct4213.cmp_3.f:24:5:
29 CONTINUE
1
Warning: Legacy Extension: Label at (1) is not in the same block as the GOTO statement at (2)
$
```
```
$ ifort cvct4213.cmp_3.f
cvct4213.cmp_3.f(13): warning #6371: A jump into a block from outside the block may have occurred. [29]
IF (EV10(J) .EQ. 0) GO TO 29
----------------------------------^
$
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVl9zm7oS_zTyy44ZaWUc8-AHapvUmTTuzfimjx0BwtALyFcSyc23vyOBG5s67cmZwzAJXu3__e1qhTHVoZVyScJPJFxPRGdLpZeqbNW0-DFJVf66JHM6vHRNaPwktalUC6qAohbtYdrKFyA8BrYIaEAJLjJ6Q-coUEZpEQnBkLE0ChfFPE1nWXgzmzMeZWxBCUa9ypGF_m8MR60OWjRgS2HhR9ccQXXW2RWw3kGmWmN1l1l4qWwJAm53-x0YK6xsZGtBtHkvVLVWgWiVLaW-FCyFAQEvQrdVe4BGGiMO0hk5dhbSV0hO8RFcwW2htNWi9Yor9yPoHf2sXuSz1I5HtfWZFJguNfK_nWxt_QqZ6Ix09jLVHKtaWJdEqbXSwXnY-1JCoepavTifhJZgSwlWGnvKhzP0B88ubGhputpeGMmeMztDxoOsOX7nQUF4PKrEoLKnwtfH3e1j_AVWT05qIPbP9mG_ud08wv1u9_Xqwd0F9XET3xOMZ7B5Yg4r7A0FA8c63sfDaUIJrjjBmBFchQTjKQYhwZU7uqZ1AesndFqRnqn1CgkuhrOtO8EVbAlfO72ed4WemrD-c8UpwXgwteJz5zHB1ZSdjqZ87MJvrOB7VjxpMVgaWcGrVk5J3bKBfAeEr4HRCy5Xi55-6eLOyfVRjyRgmzjnh6LcEYwg2PwrAJdGuN3BfgejMg2W72A6srJ5WMN695PEIoBvj9v9xumfu5QQjJ1Wgje1UkeCN9d9x7Hvd6eCXfpxiuo8yz1DH9OpIMwHdb8Zgtp_3jxcKoJ3AvURbU91GIWHEQCsdg_77cO_N5dyvTaH8Wg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