]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/50960 ([OOP] vtables not marked as constant)
authorJanus Weil <janus@gcc.gnu.org>
Wed, 9 Nov 2011 09:45:36 +0000 (10:45 +0100)
committerJanus Weil <janus@gcc.gnu.org>
Wed, 9 Nov 2011 09:45:36 +0000 (10:45 +0100)
2011-11-09  Janus Weil  <janus@gcc.gnu.org>

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

gcc/fortran/ChangeLog
gcc/fortran/class.c
gcc/fortran/expr.c
gcc/fortran/resolve.c

index 1fffbc609b6a30b5b470d760a4feac2c60f1be20..4b65c73ea384991d7079d109320ddbe5d78e121a 100644 (file)
@@ -1,3 +1,13 @@
+2011-11-09  Janus Weil  <janus@gcc.gnu.org>
+
+       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  <fxcoudert@gcc.gnu.org>
 
        PR fortran/38718
index 574d22b0b1234acb8e63676cb0224bb2cd52ca4a..dc76ad158bb47ccc98bbc1bde0239eac93adc8a6 100644 (file)
@@ -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;
index f241455965352d5582f3fd0fdd04b62dcd7d016e..8817c2ceba3fdc458582ed6f5b5d50ce04090d2a 100644 (file)
@@ -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;
index 0e882399902d42d3ee7d500815f708c88b416e07..0a8fac614be15c616848a975b9519d41c904a283 100644 (file)
@@ -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",