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, Fortran] PR 48887 [4.7] Don't mark SELECT TYPE selector as allocatable/pointer


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


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