| 1 |
! { dg-do run } |
| 2 |
! PR 119074 - the code is legal, but it makes sense to warn anyway. |
| 3 |
! { dg-additional-options "-Wall" } |
| 4 |
|
| 5 |
program memain |
| 6 |
external i1, i2 |
| 7 |
integer i1, i2 |
| 8 |
call foo (i1,1) |
| 9 |
call foo (i2,2) |
| 10 |
end program memain |
| 11 |
|
| 12 |
integer function i1(n) |
| 13 |
i1 = n + 1 |
| 14 |
end function i1 |
| 15 |
|
| 16 |
integer function i2(n,m) |
| 17 |
i2 = n + m + 1 |
| 18 |
end function i2 |
| 19 |
|
| 20 |
subroutine foo(f,n) |
| 21 |
integer, external :: f |
| 22 |
integer :: n |
| 23 |
integer :: s |
| 24 |
if (n == 1) then |
| 25 |
s = f(1) ! { dg-warning "Different argument lists" } |
| 26 |
if (s /= 2) error stop |
| 27 |
end if |
| 28 |
if (n == 2) then |
| 29 |
s = f(2,3) ! { dg-warning "Different argument lists" } |
| 30 |
if (s /= 6) error stop |
| 31 |
end if |
| 32 |
end subroutine foo |