This simple patch fixes a wrong indent and adds a _final component to the virtual tables generated for intrinsic types.

This patch not only prepares the trunk for finalization support, it also avoids ABI issues which a later addition would cause. (For intrinsic types, changing the .mod version number will not reliable force a recompilation.)

Build on x86-64-gnu-linux.
OK for the trunk?

Tobias
2012-12-31  Tobias Burnus  <bur...@net-b.de>

	* class.c (gfc_find_intrinsic_vtab): Add _final
	component.

diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c
index 61d65e7..84f383e 100644
--- a/gcc/fortran/class.c
+++ b/gcc/fortran/class.c
@@ -597,7 +597,7 @@ gfc_build_class_symbol (gfc_typespec *ts, symbol_attribute *attr,
       fclass->refs++;
       fclass->ts.type = BT_UNKNOWN;
       if (!ts->u.derived->attr.unlimited_polymorphic)
-      fclass->attr.abstract = ts->u.derived->attr.abstract;
+	fclass->attr.abstract = ts->u.derived->attr.abstract;
       fclass->f2k_derived = gfc_get_namespace (NULL, 0);
       if (gfc_add_flavor (&fclass->attr, FL_DERIVED,
 	  NULL, &gfc_current_locus) == FAILURE)
@@ -2310,6 +2708,15 @@ gfc_find_intrinsic_vtab (gfc_typespec *ts)
 	      /* Set initializer.  */
 	      c->initializer = gfc_lval_expr_from_sym (copy);
 	      c->ts.interface = copy;
+
+	      /* Add component _final.  */
+	      if (gfc_add_component (vtype, "_final", &c) == FAILURE)
+		goto cleanup;
+	      c->attr.proc_pointer = 1;
+	      c->attr.access = ACCESS_PRIVATE;
+	      c->tb = XCNEW (gfc_typebound_proc);
+	      c->tb->ppc = 1;
+	      c->initializer = gfc_get_null_expr (NULL);
 	    }
 	  vtab->ts.u.derived = vtype;
 	  vtab->value = gfc_default_initializer (&vtab->ts);

Reply via email to