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


Janus Weil wrote:
>> 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?
>   
No - the question is also what kind of warning do you want? There is
simply a lack of information but that is a general problem with
"external" - it can denote a function or a subroutine and before you use
it, you don't know what it is. Explicit interfaces are much nicer, however.

Tobias


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