This is another function argtypes issue, very similar to This code from proc_ptr_comp_13.f90 :
------------ ! PR 40882: [F03] infinite recursion in gfc_get_derived_type with PPC returning derived type. ! At the same time, check that a formal argument does not cause infinite recursion (PR 40870). implicit none type :: t procedure(foo), pointer, nopass :: ppc end type type(t) :: o, o2 o2 = o%ppc(o) contains function foo(arg) type(t) :: foo, arg end function end ------------ causes the compiler to emit wrong code for the call to o%ppc(o), because it gets the type of the function wrong. Again, the intent was to emit an incomplete function type, but this time it is on purpose, and I think unavoidable (to avoid infinite recursion). Except, it was done with the wrong middle-end call. The patch fixes it. The patch is regtested on x86_64-apple-darwin19. I also tested it on aarch64-apple-darwin20, where it fixes wrong code issues in several testcases. OK to commit? FX
ppc_dt.diff
Description: Binary data
ppc_dt.ChangeLog
Description: Binary data