This is the mail archive of the
mailing list for the GCC project.
Re: [Patch, Fortran] PR 39735: procedure pointer assignments: return value is not checked
Janus Weil wrote:
>> Additionally, I have the feeling that gfortran will leak memory if
>> resolve_intrinsic is called multiple times for the same proc pointer
>> due to gfc_copy_formal_args not freeing the memory, but I might have
>> overlooked something.
> Well, good point. I admit, I haven't checked if and under which
> circumstances it will be called more than once, but this surely might
> happen. I modified resolve_intrinsic to only call
> gfc_copy_formal_args_intr if the formal arg list is not present yet.
> This should prevent any memory leaks.
I think the patch is OK - I pondered especially about that part and I
failed to get it fail.
* * *
Related to checking but unrelated to your patch: I think the following
program is valid but it is rejected by gfortran (4.1 to 4.4 + patched
4.5). It works with NAG f95, g95, ifort, openf95 and sunf95:
real function func()
func = 42.0
end function func
external func ! subroutine or implicitly typed real function
call sub(func) ! Error: Type/rank mismatch in argument 'a'
real, external :: a
print *, a(0.4)
end subroutine sub