diff mbox

[Fortran] PR37336 - FIINAL patch [1/n]: Implement the finalization wrapper subroutine

Message ID 5037CFEC.5050404@net-b.de
State New
Headers show

Commit Message

Tobias Burnus Aug. 24, 2012, 7:03 p.m. UTC
Dear Alessandro,

Alessandro Fanfarillo wrote:
> there are some problems with the final-wrapper-v2.diff patch; I get
> Internal Error at (1):
> gfc_code2string(): Bad code
> for every test case that I use; in attachment final2.f90.

Fixed by the patch below. However, note that the current patch only 
implement the wrapper function - it doesn't handle calling the wrapper 
function. That's requires a follow up patch. (That was the reason that I 
did not do extensive test.)

The patch is a complete module.c patch, not incrementally based on the 
previous patch.

Tobias
diff mbox

Patch

diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index a4ff199..3e636cd 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -1840,17 +1840,18 @@  typedef enum
   AB_ELEMENTAL, AB_PURE, AB_RECURSIVE, AB_GENERIC, AB_ALWAYS_EXPLICIT,
   AB_CRAY_POINTER, AB_CRAY_POINTEE, AB_THREADPRIVATE,
   AB_ALLOC_COMP, AB_POINTER_COMP, AB_PROC_POINTER_COMP, AB_PRIVATE_COMP,
-  AB_VALUE, AB_VOLATILE, AB_PROTECTED, AB_LOCK_COMP,
+  AB_VALUE, AB_VOLATILE, AB_PROTECTED, AB_LOCK_COMP, AB_FINAL_COMP,
   AB_IS_BIND_C, AB_IS_C_INTEROP, AB_IS_ISO_C, AB_ABSTRACT, AB_ZERO_COMP,
   AB_IS_CLASS, AB_PROCEDURE, AB_PROC_POINTER, AB_ASYNCHRONOUS, AB_CODIMENSION,
   AB_COARRAY_COMP, AB_VTYPE, AB_VTAB, AB_CONTIGUOUS, AB_CLASS_POINTER,
-  AB_IMPLICIT_PURE
+  AB_IMPLICIT_PURE, AB_ARTIFICIAL
 }
 ab_attribute;
 
 static const mstring attr_bits[] =
 {
     minit ("ALLOCATABLE", AB_ALLOCATABLE),
+    minit ("ARTIFICIAL", AB_ARTIFICIAL),
     minit ("ASYNCHRONOUS", AB_ASYNCHRONOUS),
     minit ("DIMENSION", AB_DIMENSION),
     minit ("CODIMENSION", AB_CODIMENSION),
@@ -1883,6 +1884,7 @@  static const mstring attr_bits[] =
     minit ("VALUE", AB_VALUE),
     minit ("ALLOC_COMP", AB_ALLOC_COMP),
     minit ("COARRAY_COMP", AB_COARRAY_COMP),
+    minit ("FINAL_COMP", AB_FINAL_COMP),
     minit ("LOCK_COMP", AB_LOCK_COMP),
     minit ("POINTER_COMP", AB_POINTER_COMP),
     minit ("PROC_POINTER_COMP", AB_PROC_POINTER_COMP),
@@ -1975,6 +1977,8 @@  mio_symbol_attribute (symbol_attribute *attr)
     {
       if (attr->allocatable)
 	MIO_NAME (ab_attribute) (AB_ALLOCATABLE, attr_bits);
+      if (attr->artificial)
+	MIO_NAME (ab_attribute) (AB_ARTIFICIAL, attr_bits);
       if (attr->asynchronous)
 	MIO_NAME (ab_attribute) (AB_ASYNCHRONOUS, attr_bits);
       if (attr->dimension)
@@ -2057,6 +2061,8 @@  mio_symbol_attribute (symbol_attribute *attr)
 	MIO_NAME (ab_attribute) (AB_PRIVATE_COMP, attr_bits);
       if (attr->coarray_comp)
 	MIO_NAME (ab_attribute) (AB_COARRAY_COMP, attr_bits);
+      if (attr->final_comp)
+	MIO_NAME (ab_attribute) (AB_FINAL_COMP, attr_bits);
       if (attr->lock_comp)
 	MIO_NAME (ab_attribute) (AB_LOCK_COMP, attr_bits);
       if (attr->zero_comp)
@@ -2090,6 +2096,9 @@  mio_symbol_attribute (symbol_attribute *attr)
 	    case AB_ALLOCATABLE:
 	      attr->allocatable = 1;
 	      break;
+	    case AB_ARTIFICIAL:
+	      attr->artificial = 1;
+	      break;
 	    case AB_ASYNCHRONOUS:
 	      attr->asynchronous = 1;
 	      break;
@@ -2198,6 +2207,9 @@  mio_symbol_attribute (symbol_attribute *attr)
 	    case AB_COARRAY_COMP:
 	      attr->coarray_comp = 1;
 	      break;
+	    case AB_FINAL_COMP:
+	      attr->final_comp = 1;
+	      break;
 	    case AB_LOCK_COMP:
 	      attr->lock_comp = 1;
 	      break;