gcc/testsuite/gfortran.dg/g77/19990419-1.f
raw| 1 | c { dg-do run } |
| 2 | * Test DO WHILE, to make sure it fully reevaluates its expression. |
| 3 | * Belongs in execute/. |
| 4 | common /x/ ival |
| 5 | j = 0 |
| 6 | do while (i() .eq. 1) |
| 7 | j = j + 1 |
| 8 | if (j .gt. 5) STOP 1 |
| 9 | end do |
| 10 | if (j .ne. 4) STOP 2 |
| 11 | if (ival .ne. 5) STOP 3 |
| 12 | end |
| 13 | function i() |
| 14 | common /x/ ival |
| 15 | ival = ival + 1 |
| 16 | i = 10 |
| 17 | if (ival .lt. 5) i = 1 |
| 18 | end |
| 19 | block data |
| 20 | common /x/ ival |
| 21 | data ival/0/ |
| 22 | end |