This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, Fortran] PR 39735: procedure pointer assignments: return value is not checked


>>> 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.

Ok, I guess failed failure means success ;)
Thanks for the review. Will commit soon.


> 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
>
> program test
> ?external func ?! subroutine or implicitly typed real function
> ?call sub(func) ! Error: Type/rank mismatch in argument 'a'
> contains
> ?subroutine sub(a)
> ? real, external :: a
> ? print *, a(0.4)
> ?end subroutine sub
> end

Hm, it might be valid, but I think it still would be useful in such a
case to at least give a warning. Does none of the other compilers do?

Cheers,
Janus


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]