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,gfortran] PR 20541: ALLOCATABLE components of derivedtypes


Erik Edelmann wrote:
> Here is a patch to implement support for ALLOCATABLE components
> of derived types (part of TR15581 and F2003).  It adds a new
> field 'allocatable' to the struct gfc_component, and a few bits
> and pieces of code to take this new possibility into account.

Your patch implements only a small part of what's needed for TR 15581's
semantics for derived type components.  (I didn't find TR 15581 online, I
looked at NAG's documenation here <http://www.nag.com/nagware/NP/doc/TR.asp>).
 Essentially, you're only allowing the declaration syntax, but you're not
dealing with the automatic recursive deallocation, the deep copying and all
the other goodies that are explained there.  I don't think the patch is ready
for inclusion, as it leaves us with an unfunctional extension.

Furthermore, you should add testcases which make sure that CHARACTERs work as
expected.  Past history has shown that they're hard to get right, so it would
be ok if you only determined that they don't and pointed out a strategy how to
fix them.

> (could a patch like
> this be OK for 4.0?) 

No, our policy is to only add new language features to the mainline.  This is
not carved in stone, so if it's a simple patch it might still be possible.

[ WRT documentation ]
> OK, I'll try to write something tomorrow.  Would a mention of
> this feature in the section "Fortran 2003 status" in
> gfortran.texi be enough, or are you thinking of something more?

The mention in the Fortran 2003 status section is enough for me.  It should
make clear how far along the support is.

Cheers,
- Tobi

> 2005-09-28  Erik Edelmann  <erik.edelmann@iki.fi>
> 
> 	PR fortran/20541
> 	* gfortran.h (gfc_component): Added field "allocatable".
> 	* check.c (gfc_check_allocated): Check attributes
>           returned by gfc_variable_attr(), instead of array->symtree->n.sym->attr.
> 	* primary.c (gfc_variable_attr): Check for allocatable components
> 	  of derived types.
> 	* decl.c (build_struct): Likewise.
> 	* trans-types.c (gfc_get_derived_type): Likewise.
> 	* resolve.c (derived_allocatable): New function.
> 	  (resolve_transfer): Use it.
> 	* symbol.c (gfc_set_component_attr): Set the "allocatable" attribute.

:REVIEWMAIL:


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