[Patch,Fortran] Copy more attributes for PROCEDURE() (PR35830)

Janus Weil jaydub66@googlemail.com
Sat Jun 7 22:12:00 GMT 2008


Hi Tobi,

> For
>  PROCEDURE(interface) :: foo
> not all needed attributes where copied from interface to foo, which
> caused rejected-valid (and accept-invalid) problems, but also wrong code.
>
> I now copy now several more attributes. I hope I have not missed one.

Nice. Thanks for looking into this. The only thing that I think you
might have missed is ALLOCATABLE. Consider the following test case:

function f()
  real, allocatable :: f(:)
  allocate(f(1:3))
  f(1:3)= (/9,8,7/)
end function

program test

  abstract interface
    function ai()
      real, allocatable :: ai(:)
    end function
  end interface

  procedure(ai) :: f

  print *,f()

end

This is compiled without any trouble, but when executing I get a

Fortran runtime error: Attempting to allocate already allocated array

Just using an INTERFACE and no PROCEDURE statement, the program runs
fine and gives the expected result.

Cheers,
Janus



More information about the Fortran mailing list