| 1 |
! { dg-do compile } |
| 2 |
! { dg-options "-fdec-structure" } |
| 3 |
! |
| 4 |
! Verify that the comparisons in gfc_compare_derived_types can correctly |
| 5 |
! match nested anonymous subtypes. |
| 6 |
! |
| 7 |
|
| 8 |
subroutine sub0 (u) |
| 9 |
structure /t/ |
| 10 |
structure sub |
| 11 |
integer i |
| 12 |
end structure |
| 13 |
endstructure |
| 14 |
record /t/ u |
| 15 |
u.sub.i = 0 |
| 16 |
end subroutine sub0 |
| 17 |
|
| 18 |
subroutine sub1 () |
| 19 |
structure /t/ |
| 20 |
structure sub |
| 21 |
integer i |
| 22 |
end structure |
| 23 |
endstructure |
| 24 |
record /t/ u |
| 25 |
|
| 26 |
interface |
| 27 |
subroutine sub0 (u) ! regression: Interface mismatch.*Type mismatch |
| 28 |
structure /t/ |
| 29 |
structure sub |
| 30 |
integer i |
| 31 |
end structure |
| 32 |
endstructure |
| 33 |
record /t/ u |
| 34 |
end subroutine |
| 35 |
end interface |
| 36 |
|
| 37 |
call sub0(u) ! regression: Type mismatch in argument |
| 38 |
end subroutine |
| 39 |
|
| 40 |
subroutine sub2(u) |
| 41 |
structure /tu/ |
| 42 |
union |
| 43 |
map |
| 44 |
integer i |
| 45 |
end map |
| 46 |
map |
| 47 |
real r |
| 48 |
end map |
| 49 |
end union |
| 50 |
end structure |
| 51 |
record /tu/ u |
| 52 |
u.r = 1.0 |
| 53 |
end subroutine |
| 54 |
|
| 55 |
implicit none |
| 56 |
|
| 57 |
structure /t/ |
| 58 |
structure sub |
| 59 |
integer i |
| 60 |
end structure |
| 61 |
endstructure |
| 62 |
|
| 63 |
structure /tu/ |
| 64 |
union |
| 65 |
map |
| 66 |
integer i |
| 67 |
end map |
| 68 |
map |
| 69 |
real r |
| 70 |
end map |
| 71 |
end union |
| 72 |
end structure |
| 73 |
|
| 74 |
record /t/ u |
| 75 |
record /tu/ u2 |
| 76 |
|
| 77 |
call sub0(u) ! regression: Type mismatch in argument |
| 78 |
call sub1() |
| 79 |
call sub2(u2) |
| 80 |
|
| 81 |
end |