[PATCH,fortran]: fix for PR 32801

Christopher D. Rickett crickett@lanl.gov
Wed Jul 18 22:03:00 GMT 2007


hi all,

attached is a very simple (nearly one-line) patch that fixes PR 32801.

i did not do a full bootstrap for this simple of a patch, but i did 
regtest it on both x86 and x86_64 linux with no new failures.

:ADDPATCH fortran:

2007-07-18  Christopher D. Rickett  <crickett@lanl.gov>

 	PR fortran/32801
 	* symbol.c (generate_isocbinding_symbol): Fix bug where
 	ISOCBINDING_FUNPTR was generated for C_LOC instead of the needed
 	ISOCBINDING_PTR.

2007-07-18  Christopher D. Rickett  <crickett@lanl.gov>

 	PR fortran/32801
 	* gfortran.dg/pr32801.f03: New test case.
-------------- next part --------------
Index: gcc/testsuite/gfortran.dg/pr32801.f03
===================================================================
--- gcc/testsuite/gfortran.dg/pr32801.f03	(revision 0)
+++ gcc/testsuite/gfortran.dg/pr32801.f03	(revision 0)
@@ -0,0 +1,6 @@
+! { dg-do compile }
+! Verify that C_PTR is auto generated because it's needed by C_LOC.
+! This tests that PR 32801 is fixed.
+PROGRAM c_loc_prob
+  USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_LOC 
+END PROGRAM c_loc_prob
Index: gcc/fortran/symbol.c
===================================================================
--- gcc/fortran/symbol.c	(revision 126704)
+++ gcc/fortran/symbol.c	(working copy)
@@ -3766,8 +3772,10 @@ generate_isocbinding_symbol (const char 
                        processing the file.  */
                     generate_isocbinding_symbol
                       (mod_name, s == ISOCBINDING_FUNLOC
-                       ? ISOCBINDING_FUNPTR : ISOCBINDING_FUNPTR,
+		       || s == ISOCBINDING_F_PROCPOINTER
+		       ? ISOCBINDING_FUNPTR : ISOCBINDING_PTR,
                        (char *)(s == ISOCBINDING_FUNLOC 
+				|| s == ISOCBINDING_F_PROCPOINTER 
                                 ? "_gfortran_iso_c_binding_c_funptr"
 				: "_gfortran_iso_c_binding_c_ptr"));
                     tmp_sym->ts.derived =
 
 


More information about the Gcc-patches mailing list