<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/58378>58378</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [Flang] Compilation error in 627.cam4_s
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          kiranchandramohan
      </td>
    </tr>
</table>

<pre>
    Reproducer

Compiling the following code
```
  subroutine sb1
    integer :: i, n
    integer :: tmp
               
    !$omp parallel do
      do ifld=1,n
         do isum=1,n
           if (tmp > n) then
             exit
           endif
         enddo
         tmp = n
      enddo
   end subroutine
```
produces the following error
```
error: loc("./tmp2.f90":12:10): block with no terminator, has "fir.store"(%28, %4) : (i32, !fir.ref<i32>) -> ()
```

Most likely an interaction issue with the pre-fir tree.

Note 1: The error is not present if `!$omp end parallel do` is present.
Note 2: A crash is observed if the final assignment (`tmp=n`) is not present.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx1U0tvnDAQ_jVwsYKMeR84pLvJrT1UvVcGBnBj7JVtkubfdwY2zWazQZZh3t98M3R2eG1_wsnZYe3BRfwY8fv9PtjlpLQyEwszsNFqbV9I6u0AZ7-Sn88mMubXztk1KAPMd-mbljFlAkzgWJTd42EqEgdmvjSH5fRuu3jelZFII5EjPnaSTmoNmg32MmawTI16iLIjOh7MVTqy-nX5wop4RqxQIwxE9IBARUMUfPZjDP6q8EkNZlDjlRZ1HxHisxc4sg-JPzqidEHqTdbPo_NXUwLnrLsZsFuQZ217bDMSIonEI4IRydhwFNGWbhcKDTl26PnEXlSYmbEsgFuUkQGT4Bhn6ZEsMSqXeFQBxVPSgq4Dmoqc-KM0qFeZ2LUpBTgYo-xAuuyBnO6I7i26uYl8v79bH5hWT6BfmTTb8jjZB2Xx2_sVdqDExsnBHdZhwQEklyl-2AAsJUy_0G0jBGOxuUAxHkzYdgDr_l80msTlspWcIs7eyUVaYo7ds95JP5OL7Ty4Zxgo4zYi5E4z6b2azEKVqOGS09JnR7PVbK7AJDG0aVkWdV6UdR4PbTY0WSPjoIKGNiq-PWpppqg4sv2flRsZ57YMK0WV9HLJf_t4dbqdQzh5-tXEI54JyVq7pLcLClo_v73ucK_-QB9Q3Fj1-FHUWVXHc1tlad5kFfCyHIpa9mNTVqngkgvBi3HsYy070J6Q4ToYeNkHQ6tRHGPVCnRMeVqkeZHneTJI3gmeZmk11rKoqijnsEilE8KRWDfFrt0gdevk0aiVD_7duFMJGxGUX65htq59Uk6afpZmcHKx-I43EO3WxD9JNW1w">