diff mbox

[Fortran] PR 48887 [4.7] Don't mark SELECT TYPE selector as allocatable/pointer

Message ID CAGkQGiLMc-uftxMbZC_zCDiXQcr3+CxgSQGbZMxM+KNbFJHCLg@mail.gmail.com
State New
Headers show

Commit Message

Paul Richard Thomas Dec. 3, 2011, 5:10 p.m. UTC
Dear Tobias,

Are you checking to see if the patches really are reviewed :-)

     /* 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
>

Comments

Tobias Burnus Dec. 3, 2011, 6:31 p.m. UTC | #1
Dear Paul,

Paul Richard Thomas wrote:
> Are you checking to see if the patches really are reviewed :-)
t
I am - but involuntarily. I am sure that I build and regtested - but 
seemingly a different tree :-(

> The latter change gets rejected with my class array patch in place
> because I have:

I am really looking forward to have that patch in the trunk - it makes 
patch writing and testing easier if one does not have two separate 
trees, one clean with minor patches and one with your patch and 
occasionally some on-top patches.

> This is OK:
>
>        c->attr.pointer = attr->pointer || (attr->allocatable ? 0 :  attr->dummy)
> 			|| attr->select_type_temporary;

I have now used
     || (attr->dummy && !attr->allocatable)
instead of
     || (attr->allocatable ? 0 : attr->dummy)
which I found more readable.

I did also did a rebuild, regtested it and committed the patch as Rev. 
181975.

Thanks for the careful review!

Tobias
diff mbox

Patch

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)