This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch, Fortran] PR37253: Segmentation fault with procedure pointer


Hi all,

here is my fix for PR37253 together with Dominique's test case. The
problem was that some symbol attributes were not saved to the .mod
file (i.e. attr.procedure and attr.proc_ptr). The patch is pretty
obvious. Ok for trunk after regtesting (which I assume should go
fine)?

Cheers,
Janus



2008-08-28  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/37253
	* module.c (ab_attribute,attr_bits,mio_symbol_attribute): Take care of
	saving attr.procedure and attr.proc_ptr to the module file.


2008-08-28  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/37253
	* gfortran.dg/proc_ptr_10.f90: New.
Index: gcc/fortran/module.c
===================================================================
--- gcc/fortran/module.c	(revision 139622)
+++ gcc/fortran/module.c	(working copy)
@@ -1649,7 +1649,7 @@ typedef enum
   AB_CRAY_POINTER, AB_CRAY_POINTEE, AB_THREADPRIVATE, AB_ALLOC_COMP,
   AB_POINTER_COMP, AB_PRIVATE_COMP, AB_VALUE, AB_VOLATILE, AB_PROTECTED,
   AB_IS_BIND_C, AB_IS_C_INTEROP, AB_IS_ISO_C, AB_ABSTRACT, AB_ZERO_COMP,
-  AB_EXTENSION
+  AB_EXTENSION, AB_PROCEDURE, AB_PROC_POINTER
 }
 ab_attribute;
 
@@ -1690,6 +1690,8 @@ static const mstring attr_bits[] =
     minit ("PROTECTED", AB_PROTECTED),
     minit ("ABSTRACT", AB_ABSTRACT),
     minit ("EXTENSION", AB_EXTENSION),
+    minit ("PROCEDURE", AB_PROCEDURE),
+    minit ("PROC_POINTER", AB_PROC_POINTER),
     minit (NULL, -1)
 };
 
@@ -1805,6 +1807,10 @@ mio_symbol_attribute (symbol_attribute *
 	MIO_NAME (ab_attribute) (AB_ZERO_COMP, attr_bits);
       if (attr->extension)
 	MIO_NAME (ab_attribute) (AB_EXTENSION, attr_bits);
+      if (attr->procedure)
+	MIO_NAME (ab_attribute) (AB_PROCEDURE, attr_bits);
+      if (attr->proc_pointer)
+	MIO_NAME (ab_attribute) (AB_PROC_POINTER, attr_bits);
 
       mio_rparen ();
 
@@ -1926,6 +1932,12 @@ mio_symbol_attribute (symbol_attribute *
 	    case AB_EXTENSION:
 	      attr->extension = 1;
 	      break;
+	    case AB_PROCEDURE:
+	      attr->procedure = 1;
+	      break;
+	    case AB_PROC_POINTER:
+	      attr->proc_pointer = 1;
+	      break;
 	    }
 	}
     }

Attachment: proc_ptr_10.f90
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]