| 1 |
! { dg-do compile } |
| 2 |
! |
| 3 |
! PR fortran/124567 - rank/shape check in interface checking |
| 4 |
! |
| 5 |
! Variation of gfortran.dg/proc_decl_26.f90 |
| 6 |
|
| 7 |
program test |
| 8 |
implicit none |
| 9 |
|
| 10 |
interface |
| 11 |
subroutine one(a) |
| 12 |
integer a(:) |
| 13 |
end subroutine |
| 14 |
subroutine two(a) |
| 15 |
integer a(..) |
| 16 |
end subroutine |
| 17 |
end interface |
| 18 |
|
| 19 |
! Assumed-shape vs. deferred |
| 20 |
call foo(two) ! { dg-error "Rank mismatch in argument 'a' \\(1/-1\\)" } |
| 21 |
call bar(two) ! { dg-error "Rank mismatch in argument 'a' \\(1/-1\\)" } |
| 22 |
|
| 23 |
! Reversed |
| 24 |
call bas(one) ! { dg-error "Rank mismatch in argument 'a' \\(-1/1\\)" } |
| 25 |
call bla(one) ! { dg-error "Rank mismatch in argument 'a' \\(-1/1\\)" } |
| 26 |
|
| 27 |
contains |
| 28 |
|
| 29 |
subroutine foo(f1) |
| 30 |
procedure(one) :: f1 |
| 31 |
end subroutine foo |
| 32 |
|
| 33 |
subroutine bar(f2) |
| 34 |
interface |
| 35 |
subroutine f2(a) |
| 36 |
integer a(:) |
| 37 |
end subroutine |
| 38 |
end interface |
| 39 |
end subroutine bar |
| 40 |
|
| 41 |
subroutine bas(f1) |
| 42 |
procedure(two) :: f1 |
| 43 |
end subroutine bas |
| 44 |
|
| 45 |
subroutine bla(f2) |
| 46 |
interface |
| 47 |
subroutine f2(a) |
| 48 |
integer a(..) |
| 49 |
end subroutine |
| 50 |
end interface |
| 51 |
end subroutine bla |
| 52 |
|
| 53 |
end program |