| 1 |
! { dg-do compile } |
| 2 |
! |
| 3 |
! PR fortran/92736 |
| 4 |
! |
| 5 |
module m |
| 6 |
integer :: i, j |
| 7 |
end module m |
| 8 |
|
| 9 |
module m2 |
| 10 |
integer :: i, k |
| 11 |
end module m2 |
| 12 |
|
| 13 |
module mod |
| 14 |
use m, only: i |
| 15 |
interface |
| 16 |
module subroutine sb1() |
| 17 |
end subroutine sb1 |
| 18 |
end interface |
| 19 |
end |
| 20 |
|
| 21 |
! Error: use 'i' both for m's 'i' and 'j' |
| 22 |
submodule(mod) sub ! { dg-error "Symbol 'i' at .1. conflicts with the rename symbol" } |
| 23 |
use m1, only: i => j ! { dg-error "Symbol 'i' at .1. conflicts with the rename symbol" } |
| 24 |
end |
| 25 |
|
| 26 |
module mod2 |
| 27 |
use m, only: i |
| 28 |
interface |
| 29 |
module subroutine sb1() |
| 30 |
end subroutine sb1 |
| 31 |
end interface |
| 32 |
end |
| 33 |
|
| 34 |
! Error: use 'i' both for m's 'i' and m2's 'k' |
| 35 |
submodule(mod2) sub2 ! { dg-error "Symbol 'i' at .1. conflicts with the rename symbol" } |
| 36 |
use m2, only: i => k ! { dg-error "Symbol 'i' at .1. conflicts with the rename symbol" } |
| 37 |
end |
| 38 |
|
| 39 |
|
| 40 |
module mod3 |
| 41 |
use m, only: i |
| 42 |
interface |
| 43 |
module subroutine sb1() |
| 44 |
end subroutine sb1 |
| 45 |
end interface |
| 46 |
end |
| 47 |
|
| 48 |
! Error: use 'i' both for m's 'i' and m2's 'i' |
| 49 |
submodule(mod3) sub3 ! { dg-error "Symbol 'i' at .1. conflicts with the symbol" } |
| 50 |
use m2, only: i ! { dg-error "Symbol 'i' at .1. conflicts with the symbol" } |
| 51 |
end |
| 52 |
|
| 53 |
|
| 54 |
module mod4 |
| 55 |
use m, only: mm => i, i |
| 56 |
interface |
| 57 |
module subroutine sb1() |
| 58 |
end subroutine sb1 |
| 59 |
end interface |
| 60 |
end |
| 61 |
|
| 62 |
! OK |
| 63 |
submodule(mod4) sub4 |
| 64 |
use m, only: i |
| 65 |
use m, only: mm => i |
| 66 |
end |
| 67 |
|
| 68 |
module mod5 |
| 69 |
use m, only: mm => i |
| 70 |
interface |
| 71 |
module subroutine sb1() |
| 72 |
end subroutine sb1 |
| 73 |
end interface |
| 74 |
end |
| 75 |
|
| 76 |
! mm from both m2 and m |
| 77 |
submodule(mod5) sub5 ! { dg-error "Symbol 'mm' at .1. conflicts with the rename symbol" } |
| 78 |
use m2, only: mm => i ! { dg-error "Symbol 'mm' at .1. conflicts with the rename symbol" } |
| 79 |
end |