Procedure Pointers: a first patch

Janus Weil jaydub66@googlemail.com
Sat May 24 17:03:00 GMT 2008


Hi all,

> I have some more things, which fail. Maybe it makes sense to check-in a
> half-finished patch and continue with the fixing of the smaller items later.

I guess that would make sense. Maybe one can leave out the most exotic
special cases for a start. At least I want to make procptrs work as
formal arguments and return values, then I guess we can start to think
about committing the patch.

I attached a new version, together with some test cases, which should
give you an idea of what the patch can handle at this point.


> implicit none
> external foo
> interface
> subroutine bar()
> end subroutine bar
> end interface
> pointer :: bar
> bar => foo
> end
>
> Error: 'bar' at (1) is not a variable

Works now (see proc_ptr_3.f90).


> Add a test case that "allocate(procptr)" fails. (It currently correctly
> gives an error.)

Done (actually my test cases are still a bit sketchy and not ready for
dejagnu yet).


> The following program should be rejected:
>
> intrinsic sin
> call foo(sin)
> contains
> subroutine foo(x)
> procedure(), pointer :: x
> end subroutine foo
> end
>
> "If a dummy argument is a procedure pointer, the associated actual argument
> shall be a procedure pointer, a reference to a function that returns a
> procedure pointer, or a reference to the NULL intrinsic function."
> (12.4.1.3)

This was rejected already, but with a misleading error message, so I
put in a new one.

At the remaining stuff I will have a look soon (or disregard it as "exotic" ;)

For the moment I'm working on procptr formal arguments and return
values (see proc_ptr_4.f90). In particular I have trouble seeing why I
get a segfault there. Any help appreciated.

(Also I'm seeing a couple of regressions right now, which I will have
to look into ...)

Cheers,
Janus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: procptr135849.diff
Type: text/x-patch
Size: 15671 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20080524/ab0a22a3/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: proc_ptr_1.f90
Type: text/x-fortran
Size: 1213 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20080524/ab0a22a3/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: proc_ptr_2.f90
Type: text/x-fortran
Size: 255 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20080524/ab0a22a3/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: proc_ptr_3.f90
Type: text/x-fortran
Size: 612 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20080524/ab0a22a3/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: proc_ptr_4.f90
Type: text/x-fortran
Size: 600 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20080524/ab0a22a3/attachment-0004.bin>


More information about the Fortran mailing list