This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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]

[patch,fortran] PR 16136: ALLOCATABLE dummy arguments


:ADDPATCH:

Here's a patch that implements support for ALLOCATABLE dummy
arguments.  It does the following:

* In symbol.c (check_conflict), the check for a ALLOCATABLE/DUMMY
  conflict is made conditional on the selected standard.  Since
  we may (will) want to allow other conflicts in the future for
  standards >= 2003, I did this by creating a new macro conf_std.

* In trans-expr.c (gfc_conv_function_call), treat ALLOCATABLE
  dummy arguments the same way as POINTER dummy arguments, i.e.
  pass the address of the array descriptor.

* In addition to these things, the patch checks for a few
  constraints: The actual argument must be also be ALLOCATABLE
  (using the new function compare_allocatable from interface.c
  (compare_actual_formal)), and the dummy arguments
  mustn't get allocated or deallocated if they are INTENT(IN) (in
  resolve.c (resolve_deallocate_expr, resolve_allocate_expr)).

* And of course I added a few lines to gfortran.texi

Tested on trunk, on Linux/x86.  Ok to commit?
(I assume that this, being a new language feature, is
inappropriate for 4.1)


        Erik



2005-03-03  Erik Edelmann  <eedelman@gcc.gnu.org>

        PR fortran/16136
        * symbol.c (conf_std): New macro.
        (check_conflict): Use it to allow ALLOCATABLE dummy
        arguments for F2003.
        * trans-expr.c (gfc_conv_function_call): Pass pass the
        address of the array descriptor when dummy argument is
        ALLOCATABLE.
        * interface.c (compare_allocatable): New function.
        (compare_actual_formal): Use it.
        resolve.c (resolve_deallocate_expr,
        resolve_allocate_expr): Check that INTENT(IN) variables
        aren't (de)allocated.
        * gfortran.texi (Fortran 2003 status): List ALLOCATABLE
        dummy arguments as supported.


2005-03-03  Erik Edelmann  <eedelman@gcc.gnu.org>

        PR fortran/16136
        * allocatable_dummy_1.f90: New.
        * allocatable_dummy_2.f90: New.

Attachment: 16136.diff
Description: Text document

Attachment: allocatable_dummy_1.f90
Description: Text document

Attachment: allocatable_dummy_2.f90
Description: Text document


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