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] [2/4] C binding access to C_PTR type: use gfc_get_iso_c_binding_dt


gen_cptr_param uses gfc_get_ha_symbol to retrieve the c_ptr symbol.
This is not safe to symbol renaming and to symbol hiding.
This patch changes it to use get_iso_c_binding_dt, which is the function used
elsewhere.

Attachment: pr55574_v20-2.CL
Description: Text document

diff --git a/symbol.c b/symbol.c
index 4e6004f..646ca9d 100644
--- a/symbol.c
+++ b/symbol.c
@@ -3923,14 +3923,8 @@ gen_cptr_param (gfc_formal_arglist **head,
   gfc_symtree *param_symtree = NULL;
   gfc_formal_arglist *formal_arg = NULL;
   const char *c_ptr_in;
-  const char *c_ptr_type = NULL;
   iso_c_binding_symbol c_ptr_id;
 
-  if (iso_c_sym_id == ISOCBINDING_F_PROCPOINTER)
-    c_ptr_type = "c_funptr";
-  else
-    c_ptr_type = "c_ptr";
-
   if(c_ptr_name == NULL)
     c_ptr_in = "gfc_cptr__";
   else
@@ -3965,7 +3959,7 @@ gen_cptr_param (gfc_formal_arglist **head,
       /* This can happen if the user did not define c_ptr but they are
 	 trying to use one of the iso_c_binding functions that need it.  */
       generate_isocbinding_symbol (module_name, c_ptr_id, NULL);
-      gfc_get_ha_symbol (c_ptr_type, &(c_ptr_sym));
+      c_ptr_sym = get_iso_c_binding_dt (c_ptr_id);
     }
 
   param_sym->ts.u.derived = c_ptr_sym;

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