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.
2013-03-02 Mikael Morin <mik...@gcc.gnu.org>
* symbol.c (gen_cptr_param): Retrieve pointer type symbol using get_iso_c_binding_dt.
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;