| 1 |
! { dg-do run } |
| 2 |
! { dg-additional-options "-fdump-tree-original" } |
| 3 |
! |
| 4 |
! PR fortran/107441 |
| 5 |
! Check that procedure types and procedure decls match when the procedure |
| 6 |
! has both character-typed and optional value args. |
| 7 |
! |
| 8 |
! Contributed by M.Morin |
| 9 |
|
| 10 |
program p |
| 11 |
interface |
| 12 |
subroutine i(c, o) |
| 13 |
character(*) :: c |
| 14 |
integer, optional, value :: o |
| 15 |
end subroutine i |
| 16 |
end interface |
| 17 |
procedure(i), pointer :: pp |
| 18 |
pp => s |
| 19 |
call pp("abcd") |
| 20 |
contains |
| 21 |
subroutine s(c, o) |
| 22 |
character(*) :: c |
| 23 |
integer, optional, value :: o |
| 24 |
if (present(o)) stop 1 |
| 25 |
if (len(c) /= 4) stop 2 |
| 26 |
if (c /= "abcd") stop 3 |
| 27 |
end subroutine s |
| 28 |
end program p |
| 29 |
|
| 30 |
! { dg-final { scan-tree-dump "void s .* c, .* o, logical.* \.o, integer.* _c" "original" } } |
| 31 |
! { dg-final { scan-tree-dump ", integer.*, logical.*, integer.* pp" "original" } } |