]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: [multiple changes]
authorDominique d'Humieres <dominiq@lps.ens.fr>
Sat, 24 May 2014 15:36:14 +0000 (17:36 +0200)
committerDominique d'Humieres <dominiq@gcc.gnu.org>
Sat, 24 May 2014 15:36:14 +0000 (17:36 +0200)
2014-05-24  Dominique d'Humieres <dominiq@lps.ens.fr>

Backport r195492 and r195815
2013-01-27  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/55789
PR fortran/56047
* gfortran.h : Add associate_var to symbol_attr.
* resolve.c (resolve_assoc_var): Set associate_var attribute.
If the target class_ok is set, set it for the associate
variable.
* check.c (allocatable_check): Associate variables should not
have the allocatable attribute even if their symbols do.
* class.c (gfc_build_class_symbol): Symbols with associate_var
set will always have a good class container.

2013-02-06  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/55789
* trans-array.c (trans_array_constructor): Remove condition
'dynamic' = true if the loop ubound is a VAR_DECL.

From-SVN: r210893

gcc/fortran/ChangeLog
gcc/fortran/check.c
gcc/fortran/class.c
gcc/fortran/gfortran.h
gcc/fortran/resolve.c
gcc/fortran/trans-array.c

index 11cbdde933b373a4dbc4b74aef80a3c1e3519f92..6694c59553346d80cdf2f5bdb09adca42c2c06c9 100644 (file)
@@ -1,3 +1,25 @@
+2014-05-24  Dominique d'Humieres <dominiq@lps.ens.fr>
+
+       Backport r195492 and r195815
+       2013-01-27  Paul Thomas  <pault@gcc.gnu.org>
+
+       PR fortran/55789
+       PR fortran/56047
+       * gfortran.h : Add associate_var to symbol_attr.
+       * resolve.c (resolve_assoc_var): Set associate_var attribute.
+       If the target class_ok is set, set it for the associate
+       variable.
+       * check.c (allocatable_check): Associate variables should not
+       have the allocatable attribute even if their symbols do.
+       * class.c (gfc_build_class_symbol): Symbols with associate_var
+       set will always have a good class container.
+
+       2013-02-06  Paul Thomas  <pault@gcc.gnu.org>
+
+       PR fortran/55789
+       * trans-array.c (trans_array_constructor): Remove condition
+       'dynamic' = true if the loop ubound is a VAR_DECL.
+
 2014-03-29  Mikael Morin  <mikael@gcc.gnu.org>
 
        PR fortran/60677
index f6195aa8b3a04c75241343040815f07f2ed845fb..e5fd0374829ad7853b54cda54991f90b47dc62a4 100644 (file)
@@ -454,7 +454,7 @@ allocatable_check (gfc_expr *e, int n)
   symbol_attribute attr;
 
   attr = gfc_variable_attr (e, NULL);
-  if (!attr.allocatable)
+  if (!attr.allocatable || attr.associate_var)
     {
       gfc_error ("'%s' argument of '%s' intrinsic at %L must be ALLOCATABLE",
                 gfc_current_intrinsic_arg[n]->name, gfc_current_intrinsic,
index d4ed6b043ac29e30c341e0de503332ef2dc2a275..55278cae07578234bc2486c1f73def19508f0f85 100644 (file)
@@ -493,7 +493,7 @@ gfc_build_class_symbol (gfc_typespec *ts, symbol_attribute *attr,
     return SUCCESS;
 
   attr->class_ok = attr->dummy || attr->pointer || attr->allocatable
-                  || attr->select_type_temporary;
+                  || attr->select_type_temporary || attr->associate_var;
   
   if (!attr->class_ok)
     /* We can not build the class container yet.  */
index 54310dfbea15461800fee8cb686f92ccd121ded9..7db6dc55055c843c221c01589b17ffc2ef9d1e96 100644 (file)
@@ -786,8 +786,9 @@ typedef struct
   unsigned alloc_comp:1, pointer_comp:1, proc_pointer_comp:1,
           private_comp:1, zero_comp:1, coarray_comp:1, lock_comp:1;
 
-  /* This is a temporary selector for SELECT TYPE.  */
-  unsigned select_type_temporary:1;
+  /* This is a temporary selector for SELECT TYPE or an associate
+     variable for SELECT_TYPE or ASSOCIATE.  */
+  unsigned select_type_temporary:1, associate_var:1;
 
   /* Attributes set by compiler extensions (!GCC$ ATTRIBUTES).  */
   unsigned ext_attr:EXT_ATTR_NUM;
index 514060882d650457e1e6979c24c1996ab8ac9a36..7cd2a4069c05d2e3189f7610b5c93ab380f6b4ea 100644 (file)
@@ -7991,6 +7991,13 @@ resolve_assoc_var (gfc_symbol* sym, bool resolve_target)
         has no corank.  */
       sym->as->corank = 0;
     }
+
+  /* Mark this as an associate variable.  */
+  sym->attr.associate_var = 1;
+
+  /* If the target is a good class object, so is the associate variable.  */
+  if (sym->ts.type == BT_CLASS && gfc_expr_attr (target).class_ok)
+    sym->attr.class_ok = 1;
 }
 
 
index 25340f58eea2765086bd81a6ad9318c517dbc935..b9574627f1d12cd34c9fd65ef912e4a74e8006ae 100644 (file)
@@ -2282,9 +2282,6 @@ trans_array_constructor (gfc_ss * ss, locus * where)
        }
     }
 
-  if (TREE_CODE (*loop_ubound0) == VAR_DECL)
-    dynamic = true;
-
   gfc_trans_create_temp_array (&outer_loop->pre, &outer_loop->post, ss, type,
                               NULL_TREE, dynamic, true, false, where);