[Bug fortran/62125] Nested select type not accepted (rejects valid)

mrestelli at gmail dot com gcc-bugzilla@gcc.gnu.org
Mon Jul 11 15:32:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62125

--- Comment #5 from mrestelli <mrestelli at gmail dot com> ---
I think the following patch could solve the problem:


Index: gcc/fortran/symbol.c
===================================================================
--- gcc/fortran/symbol.c        (revision 238083)
+++ gcc/fortran/symbol.c        (working copy)
@@ -2930,7 +2930,11 @@
   gfc_select_type_stack *stack = select_type_stack;
   for (; stack; stack = stack->prev)
     if ((*st)->n.sym == stack->selector && stack->tmp)
-      *st = stack->tmp;
+      {
+        *st = stack->tmp;
+        select_type_insert_tmp (st);
+        return;
+      }
 }


The idea is that now a variable acting as selector in a SELECT TYPE is
"promoted" to a tmp variable only once; this change does it
recursively.

(I don't know whether this breaks anything, I don't know how to run
the regression tests myself)


More information about the Gcc-bugs mailing list