This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, Fortran] PR 48887 [4.7] Don't mark SELECT TYPE selector as allocatable/pointer
- From: Paul Richard Thomas <paul dot richard dot thomas at gmail dot com>
- To: Tobias Burnus <burnus at net-b dot de>
- Cc: gcc patches <gcc-patches at gcc dot gnu dot org>, gfortran <fortran at gcc dot gnu dot org>
- Date: Sat, 3 Dec 2011 18:10:24 +0100
- Subject: Re: [Patch, Fortran] PR 48887 [4.7] Don't mark SELECT TYPE selector as allocatable/pointer
- References: <4EDA3AE4.2010903@net-b.de>
Dear Tobias,
Are you checking to see if the patches really are reviewed :-)
Index: gcc/fortran/class.c
===================================================================
--- gcc/fortran/class.c (Revision 181967)
+++ gcc/fortran/class.c (Arbeitskopie)
@@ -188,7 +188,8 @@ gfc_build_class_symbol (gfc_typespec *ts, symbol_a
/* Class container has already been built. */
return SUCCESS;
- attr->class_ok = attr->dummy || attr->pointer || attr->allocatable;
+ attr->class_ok = attr->dummy || attr->pointer || attr->allocatable
+ || attr.select_type_temporary;
/* Ahem, ahem! */
if (!attr->class_ok)
/* We can not build the class container yet. */
@@ -239,7 +240,8 @@ gfc_build_class_symbol (gfc_typespec *ts, symbol_a
c->attr.access = ACCESS_PRIVATE;
c->ts.u.derived = ts->u.derived;
c->attr.class_pointer = attr->pointer;
- c->attr.pointer = attr->pointer || attr->dummy;
+ c->attr.pointer = attr->pointer || attr->dummy
+ || attr.select_type_temporary; /* Ahem, ahem! */
c->attr.allocatable = attr->allocatable;
c->attr.dimension = attr->dimension;
c->attr.codimension = attr->codimension;
The latter change gets rejected with my class array patch in place
because I have:
c->attr.pointer = attr->pointer || (attr->allocatable ? 0 : attr->dummy);
This prevents the conflict that occurs when an allocatable dummy is
allocated in the sub-program scope. This is OK:
c->attr.pointer = attr->pointer || (attr->allocatable ? 0 : attr->dummy)
|| attr->select_type_temporary;
Apart from the two points above, it's OK for trunk.
Thanks for the patch and the test of my attention!
Paul
On Sat, Dec 3, 2011 at 4:06 PM, Tobias Burnus <burnus@net-b.de> wrote:
> gfortran wrongly marks the selector of a SELECT TYPE as having the pointer
> or allocatable attribute. Result: No error if one tries to change the
> allocation status.
>
> "If the selector is allocatable, it shall be allocated; the associate name
> is associated with the data object and does not have the ALLOCATABLE
> attribute." (F2008).
>
> Build and regtested on x86-64-linux.
> OK for the trunk?
>
> Tobias
>
--
The knack of flying is learning how to throw yourself at the ground and miss.
? ? ?? --Hitchhikers Guide to the Galaxy