Le 30/10/2022 à 22:25, Mikael Morin a écrit :
Le 30/10/2022 à 20:23, Mikael Morin a écrit :
Another probable issue is your change to create_function_arglist
changes arglist/hidden_arglist without also changing
typelist/hidden_typelist accordingly. I think a change to
gfc_get_function_type is also necessary: as the function decl is
changed, the decl type need to be changed as well.
I will see whether I can manage to exhibit testcases for these issues.
Here is a test for the type vs decl mismatch.
! { dg-do run }
!
! PR fortran/107441
! Check that procedure types and procedure decls match when the procedure
! has both chaacter-typed and optional value args.
program p
interface
subroutine i(c, o)
character(*) :: c
integer, optional, value :: o
end subroutine i
end interface
procedure(i), pointer :: pp
A pointer initialization is missing here:
pp => s
call pp("abcd")
contains
subroutine s(c, o)
character(*) :: c
integer, optional, value :: o
if (present(o)) stop 1
if (len(c) /= 4) stop 2
if (c /= "abcd") stop 3
end subroutine s
end program p
With the additional initialization, the test passes, so it's not very
useful. The type mismatch is visible in the dump though, so maybe a
dump match can be used.