| 1 |
! { dg-do run } |
| 2 |
! PR 35995 - ifunction.m4 and ifunction_logical.m4 had a bug |
| 3 |
! where zero-sized arguments were not handled correctly. |
| 4 |
! Test case provided by Dick Hendrickson, amended by |
| 5 |
! Thomas Koenig. |
| 6 |
|
| 7 |
program try_gf0026_etc |
| 8 |
|
| 9 |
call gf0026( 0, 1) |
| 10 |
call foo ( 0, 1) |
| 11 |
|
| 12 |
end program |
| 13 |
|
| 14 |
SUBROUTINE GF0026(nf0,nf1) |
| 15 |
LOGICAL LDA(9) |
| 16 |
INTEGER IDA(NF0,9), iii(9) |
| 17 |
|
| 18 |
lda = (/ (i/2*2 .eq. I, i=1,9) /) |
| 19 |
LDA = ALL ( IDA .NE. -1000, 1) |
| 20 |
if (.not. all(lda)) STOP 1 |
| 21 |
if (.not. all(ida .ne. -1000)) STOP 2 |
| 22 |
|
| 23 |
lda = (/ (i/2*2 .eq. I, i=1,9) /) |
| 24 |
LDA = any ( IDA .NE. -1000, 1) |
| 25 |
print *, lda !expect FALSE |
| 26 |
if (any(lda)) STOP 3 |
| 27 |
print *, any(ida .ne. -1000) !expect FALSE |
| 28 |
if (any(ida .ne. -1000)) STOP 4 |
| 29 |
|
| 30 |
iii = 137 |
| 31 |
iii = count ( IDA .NE. -1000, 1) |
| 32 |
if (any(iii /= 0)) STOP 5 |
| 33 |
if (count(ida .ne. -1000) /= 0) STOP 6 |
| 34 |
|
| 35 |
END SUBROUTINE |
| 36 |
|
| 37 |
subroutine foo (nf0, nf1) |
| 38 |
integer, dimension(9):: res, iii |
| 39 |
integer, dimension(nf0,9) :: ida |
| 40 |
res = (/ (-i, i=1,9) /) |
| 41 |
res = product (ida, 1) |
| 42 |
if (any(res /= 1)) STOP 7 |
| 43 |
end subroutine foo |