| 1 |
! { dg-do compile } |
| 2 |
! |
| 3 |
! Contributed by Mark Eggleston <[email protected]> |
| 4 |
|
| 5 |
subroutine f(a, b) |
| 6 |
integer :: a |
| 7 |
real :: b |
| 8 |
|
| 9 |
write(*,*) a, b |
| 10 |
end subroutine |
| 11 |
|
| 12 |
subroutine g(a, b) |
| 13 |
integer :: a |
| 14 |
character(*) :: b |
| 15 |
|
| 16 |
write(*,*) a, b |
| 17 |
end subroutine |
| 18 |
|
| 19 |
subroutine h |
| 20 |
interface |
| 21 |
subroutine f(a, b) ! { dg-error "\\(CHARACTER\\(\\*\\)/REAL\\(4\\)\\)" } |
| 22 |
integer :: a |
| 23 |
character(*) :: b |
| 24 |
end subroutine |
| 25 |
subroutine g(a, b) ! { dg-error "\\(REAL\\(4\\)/CHARACTER\\(\\*\\)\\)" } |
| 26 |
integer :: a |
| 27 |
real :: b |
| 28 |
end subroutine |
| 29 |
end interface |
| 30 |
|
| 31 |
call f(6, 6.0) |
| 32 |
call g(6, "abcdef") |
| 33 |
end subroutine |
| 34 |
|
| 35 |
subroutine f4(a, b) |
| 36 |
integer :: a |
| 37 |
real :: b |
| 38 |
|
| 39 |
write(*,*) a, b |
| 40 |
end subroutine |
| 41 |
|
| 42 |
subroutine g4(a, b) |
| 43 |
integer :: a |
| 44 |
character(*,4) :: b |
| 45 |
|
| 46 |
write(*,*) a, b |
| 47 |
end subroutine |
| 48 |
|
| 49 |
subroutine h4 |
| 50 |
interface |
| 51 |
subroutine f4(a, b) ! { dg-error "\\(CHARACTER\\(\\*,4\\)/REAL\\(4\\)\\)" } |
| 52 |
integer :: a |
| 53 |
character(*,4) :: b |
| 54 |
end subroutine |
| 55 |
subroutine g4(a, b) ! { dg-error "REAL\\(4\\)/CHARACTER\\(\\*,4\\)" } |
| 56 |
integer :: a |
| 57 |
real :: b |
| 58 |
end subroutine |
| 59 |
end interface |
| 60 |
|
| 61 |
call f4(6, 6.0) |
| 62 |
call g4(6, 4_"abcdef") |
| 63 |
end subroutine |
| 64 |
|
| 65 |
program test |
| 66 |
call h |
| 67 |
call h4 |
| 68 |
end program |
| 69 |
|
| 70 |
! { dg-error "passed REAL\\(4\\) to CHARACTER\\(\\*\\)" "type mismatch" { target \*-\*-\* } 31 } |
| 71 |
! { dg-error "passed CHARACTER\\(6\\) to REAL\\(4\\)" "type mismatch" { target \*-\*-\* } 32 } |
| 72 |
! { dg-error "passed REAL\\(4\\) to CHARACTER\\(\\*,4\\)" "type mismatch" { target \*-\*-\* } 61 } |
| 73 |
! { dg-error "passed CHARACTER\\(6,4\\) to REAL\\(4\\)" "type mismatch" { target \*-\*-\* } 62 } |