backport: [multiple changes]

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
This commit is contained in:
Dominique d'Humieres 2014-05-24 17:36:14 +02:00 committed by Dominique d'Humieres
parent a01bf26c96
commit 45bb155d8c
6 changed files with 34 additions and 7 deletions

View 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

View 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,

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

View 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;

View 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;
}

View 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);