diff options
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 13 | ||||
-rw-r--r-- | gcc/fortran/check.c | 2 | ||||
-rw-r--r-- | gcc/fortran/class.c | 2 | ||||
-rw-r--r-- | gcc/fortran/gfortran.h | 5 | ||||
-rw-r--r-- | gcc/fortran/resolve.c | 7 |
5 files changed, 25 insertions, 4 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 102f212..38ae004 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,16 @@ +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-01-23 Janus Weil <janus@gcc.gnu.org> PR fortran/56081 diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c index de1b729..8bd0645 100644 --- a/gcc/fortran/check.c +++ b/gcc/fortran/check.c @@ -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, diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c index 9ef30f6..d8e7b6d 100644 --- a/gcc/fortran/class.c +++ b/gcc/fortran/class.c @@ -568,7 +568,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. */ diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h index ed05c10..6be507f 100644 --- a/gcc/fortran/gfortran.h +++ b/gcc/fortran/gfortran.h @@ -803,8 +803,9 @@ typedef struct private_comp:1, zero_comp:1, coarray_comp:1, lock_comp:1, defined_assign_comp:1, unlimited_polymorphic: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; diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index ddb6d67..f2e6b9d 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -8325,6 +8325,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; } |