diff options
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/fortran/match.c | 19 | ||||
-rw-r--r-- | gcc/fortran/primary.c | 2 | ||||
-rw-r--r-- | gcc/fortran/resolve.c | 10 |
4 files changed, 34 insertions, 8 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 9d7d7c744ef..e5e8e7fe340 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,5 +1,16 @@ 2011-12-19 Tobias Burnus <burnus@net-b.de> + PR fortran/51605 + * match.c (gfc_match_select_type): Handle + scalar polymophic coarrays. + (select_type_set_tmp, ): Ditto; avoid segfault if !class_ok. + * primary.c (gfc_match_rvalue): Avoid segfault if !class_ok. + * resolve.c (resolve_select_type): Ditto. + (resolve_assoc_var): Fix setting the TARGET attribute for + polymorphic selectors which are pointers. + +2011-12-19 Tobias Burnus <burnus@net-b.de> + * check.c (coarray_check): Add class ref if needed. * resolve.c (resolve_fl_var_and_proc, resolve_fl_derived0, resolve_symbol): Fix checking diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c index 0e127300150..fd91921c979 100644 --- a/gcc/fortran/match.c +++ b/gcc/fortran/match.c @@ -5154,19 +5154,27 @@ select_type_set_tmp (gfc_typespec *ts) /* Copy across the array spec to the selector, taking care as to whether or not it is a class object or not. */ - if (select_type_stack->selector->ts.type == BT_CLASS && - CLASS_DATA (select_type_stack->selector)->attr.dimension) + if (select_type_stack->selector->ts.type == BT_CLASS + && select_type_stack->selector->attr.class_ok + && (CLASS_DATA (select_type_stack->selector)->attr.dimension + || CLASS_DATA (select_type_stack->selector)->attr.codimension)) { if (ts->type == BT_CLASS) { - CLASS_DATA (tmp->n.sym)->attr.dimension = 1; + CLASS_DATA (tmp->n.sym)->attr.dimension + = CLASS_DATA (select_type_stack->selector)->attr.dimension; + CLASS_DATA (tmp->n.sym)->attr.codimension + = CLASS_DATA (select_type_stack->selector)->attr.codimension; CLASS_DATA (tmp->n.sym)->as = gfc_get_array_spec (); CLASS_DATA (tmp->n.sym)->as = CLASS_DATA (select_type_stack->selector)->as; } else { - tmp->n.sym->attr.dimension = 1; + tmp->n.sym->attr.dimension + = CLASS_DATA (select_type_stack->selector)->attr.dimension; + tmp->n.sym->attr.codimension + = CLASS_DATA (select_type_stack->selector)->attr.codimension; tmp->n.sym->as = gfc_get_array_spec (); tmp->n.sym->as = CLASS_DATA (select_type_stack->selector)->as; } @@ -5248,7 +5256,8 @@ gfc_match_select_type (void) && expr1->ts.type != BT_UNKNOWN && CLASS_DATA (expr1) && (strcmp (CLASS_DATA (expr1)->name, "_data") == 0) - && CLASS_DATA (expr1)->attr.dimension + && (CLASS_DATA (expr1)->attr.dimension + || CLASS_DATA (expr1)->attr.codimension) && expr1->ref && expr1->ref->type == REF_ARRAY && expr1->ref->next == NULL; diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c index afc4684682f..f79ed228d2f 100644 --- a/gcc/fortran/primary.c +++ b/gcc/fortran/primary.c @@ -2914,7 +2914,7 @@ gfc_match_rvalue (gfc_expr **result) break; } - if (sym->ts.type == BT_CLASS + if (sym->ts.type == BT_CLASS && sym->attr.class_ok && (CLASS_DATA (sym)->attr.dimension || CLASS_DATA (sym)->attr.codimension)) { diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 5e8371a622b..4bfdb7987bf 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -7817,9 +7817,12 @@ resolve_assoc_var (gfc_symbol* sym, bool resolve_target) sym->attr.asynchronous = tsym->attr.asynchronous; sym->attr.volatile_ = tsym->attr.volatile_; - sym->attr.target = (tsym->attr.target || tsym->attr.pointer); + if (tsym->ts.type == BT_CLASS) + sym->attr.target = tsym->attr.target || CLASS_DATA (tsym)->attr.pointer; + else + sym->attr.target = tsym->attr.target || tsym->attr.pointer; - if (sym->ts.type == BT_DERIVED && target->symtree->n.sym->ts.type == BT_CLASS) + if (sym->ts.type == BT_DERIVED && tsym->ts.type == BT_CLASS) target->rank = sym->as ? sym->as->rank : 0; } @@ -7887,6 +7890,9 @@ resolve_select_type (gfc_code *code, gfc_namespace *old_ns) return; } + if (!code->expr1->symtree->n.sym->attr.class_ok) + return; + if (code->expr2) { if (code->expr1->symtree->n.sym->attr.untyped) |