aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/decl.c
diff options
context:
space:
mode:
authorJanus Weil <janus@gcc.gnu.org>2011-02-16 21:51:56 +0100
committerJanus Weil <janus@gcc.gnu.org>2011-02-16 21:51:56 +0100
commit528622fd85a8e2f7c8f70c4e8a9486c4c426c4a5 (patch)
tree878888203c200925a89236008d41c176a21e0259 /gcc/fortran/decl.c
parentebcb4bc3047888b1c9a655255c56257ff32dbc0b (diff)
downloadgcc-528622fd85a8e2f7c8f70c4e8a9486c4c426c4a5.zip
gcc-528622fd85a8e2f7c8f70c4e8a9486c4c426c4a5.tar.gz
gcc-528622fd85a8e2f7c8f70c4e8a9486c4c426c4a5.tar.bz2
re PR fortran/47745 ([OOP] Segfault with CLASS(*) and derived type dummy arguments)
2011-02-16 Janus Weil <janus@gcc.gnu.org> PR fortran/47745 * class.c (gfc_build_class_symbol): Set 'class_ok' attribute. * decl.c (build_sym,attr_decl1): Move setting of 'class_ok' into 'gfc_build_class_symbol'. (gfc_match_decl_type_spec): Reject unlimited polymorphism. * interface.c (matching_typebound_op): Check for 'class_ok' attribute. * match.c (select_type_set_tmp): Move setting of 'class_ok' into 'gfc_build_class_symbol'. * primary.c (gfc_variable_attr): Check for 'class_ok' attribute. 2011-02-16 Janus Weil <janus@gcc.gnu.org> PR fortran/47745 * gfortran.dg/class_39.f03: New. From-SVN: r170223
Diffstat (limited to 'gcc/fortran/decl.c')
-rw-r--r--gcc/fortran/decl.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 9712ea2..8b5f92b 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -1177,9 +1177,7 @@ build_sym (const char *name, gfc_charlen *cl, bool cl_deferred,
sym->attr.implied_index = 0;
- if (sym->ts.type == BT_CLASS
- && (sym->attr.class_ok = sym->attr.dummy || sym->attr.pointer
- || sym->attr.allocatable))
+ if (sym->ts.type == BT_CLASS)
return gfc_build_class_symbol (&sym->ts, &sym->attr, &sym->as, false);
return SUCCESS;
@@ -2613,6 +2611,16 @@ gfc_match_decl_type_spec (gfc_typespec *ts, int implicit_flag)
ts->type = BT_DERIVED;
else
{
+ /* Match CLASS declarations. */
+ m = gfc_match (" class ( * )");
+ if (m == MATCH_ERROR)
+ return MATCH_ERROR;
+ else if (m == MATCH_YES)
+ {
+ gfc_fatal_error ("Unlimited polymorphism at %C not yet supported");
+ return MATCH_ERROR;
+ }
+
m = gfc_match (" class ( %n )", name);
if (m != MATCH_YES)
return m;
@@ -6045,9 +6053,7 @@ attr_decl1 (void)
}
}
- if (sym->ts.type == BT_CLASS && !sym->attr.class_ok
- && (sym->attr.class_ok = sym->attr.class_ok || current_attr.allocatable
- || current_attr.pointer)
+ if (sym->ts.type == BT_CLASS
&& gfc_build_class_symbol (&sym->ts, &sym->attr, &sym->as, false) == FAILURE)
{
m = MATCH_ERROR;