gcc/testsuite/gfortran.fortran-torture/execute/arithmeticif.f90
raw| 1 | ! Program to test the arithmetic if statement |
| 2 | function testif (a) |
| 3 | implicit none |
| 4 | integer a, b, testif |
| 5 | |
| 6 | if (a) 1, 2, 3 |
| 7 | b = 2 |
| 8 | goto 4 |
| 9 | 1 b = -1 |
| 10 | goto 4 |
| 11 | 2 b = 0 |
| 12 | goto 4 |
| 13 | 3 b = 1 |
| 14 | 4 testif = b |
| 15 | end function |
| 16 | |
| 17 | program testwrite |
| 18 | implicit none |
| 19 | integer i |
| 20 | integer testif |
| 21 | |
| 22 | if (testif (-10) .ne. -1) STOP 1 |
| 23 | if (testif (0) .ne. 0) STOP 2 |
| 24 | if (testif (10) .ne. 1) STOP 3 |
| 25 | end program |