From: Janus Weil Date: Wed, 9 Nov 2011 09:45:36 +0000 (+0100) Subject: re PR fortran/50960 ([OOP] vtables not marked as constant) X-Git-Tag: releases/gcc-4.7.0~2322 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9c63ca5a1da8f003feff00d808d5d67931038d29;p=thirdparty%2Fgcc.git re PR fortran/50960 ([OOP] vtables not marked as constant) 2011-11-09 Janus Weil PR fortran/50960 * class.c (gfc_find_derived_vtab): Make the vtab symbols FL_PARAMETER. * expr.c (gfc_simplify_expr): Prevent vtabs from being replaced with their value. * resolve.c (resolve_values): Use-associated symbols do not need to be resolved again. (resolve_fl_parameter): Make sure the symbol has a value. From-SVN: r181199 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 1fffbc609b6a..4b65c73ea384 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,13 @@ +2011-11-09 Janus Weil + + PR fortran/50960 + * class.c (gfc_find_derived_vtab): Make the vtab symbols FL_PARAMETER. + * expr.c (gfc_simplify_expr): Prevent vtabs from being replaced with + their value. + * resolve.c (resolve_values): Use-associated symbols do not need to + be resolved again. + (resolve_fl_parameter): Make sure the symbol has a value. + 2011-11-08 Francois-Xavier Coudert PR fortran/38718 diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c index 574d22b0b123..dc76ad158bb4 100644 --- a/gcc/fortran/class.c +++ b/gcc/fortran/class.c @@ -428,7 +428,7 @@ gfc_find_derived_vtab (gfc_symbol *derived) { gfc_get_symbol (name, ns, &vtab); vtab->ts.type = BT_DERIVED; - if (gfc_add_flavor (&vtab->attr, FL_VARIABLE, NULL, + if (gfc_add_flavor (&vtab->attr, FL_PARAMETER, NULL, &gfc_current_locus) == FAILURE) goto cleanup; vtab->attr.target = 1; diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index f24145596535..8817c2ceba3f 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -1883,7 +1883,8 @@ gfc_simplify_expr (gfc_expr *p, int type) initialization expression, or we want a subsection. */ if (p->symtree->n.sym->attr.flavor == FL_PARAMETER && (gfc_init_expr_flag || p->ref - || p->symtree->n.sym->value->expr_type != EXPR_ARRAY)) + || p->symtree->n.sym->value->expr_type != EXPR_ARRAY) + && !p->symtree->n.sym->attr.vtab) { if (simplify_parameter_variable (p, type) == FAILURE) return FAILURE; diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 0e882399902d..0a8fac614be1 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -9514,7 +9514,7 @@ resolve_values (gfc_symbol *sym) { gfc_try t; - if (sym->value == NULL) + if (sym->value == NULL || sym->attr.use_assoc) return; if (sym->value->expr_type == EXPR_STRUCTURE) @@ -11982,7 +11982,7 @@ resolve_fl_parameter (gfc_symbol *sym) /* Make sure the types of derived parameters are consistent. This type checking is deferred until resolution because the type may refer to a derived type from the host. */ - if (sym->ts.type == BT_DERIVED + if (sym->ts.type == BT_DERIVED && sym->value && !gfc_compare_types (&sym->ts, &sym->value->ts)) { gfc_error ("Incompatible derived type in PARAMETER at %L",