[Patch, fortran] [0/4] PR55574: C binding access to C_PTR type

Mikael Morin mikael.morin@sfr.fr
Sat Mar 2 16:54:00 GMT 2013


Hello,

as promised, here comes the patch for PR55574, where for code like:
  use iso_c_binding, only : c_loc
  type(C_PTR) :: f_ptr

the second statement is accepted despite c_ptr not being use-associated, as
c_loc implicitly pulls-in c_ptr.
This regression comes from Tobias' "constructor" patch (support for generics
with the same name as a derived type), which changed mangled names
"_gfortran_iso_c_binding_c_ptr" to real names "c_ptr".

The fix proposed here adds a "hidden" argument to `generate_isocbinding_symbol',
so that we know whether the symbol should be made accessible or not.
Then, we use either `gfc_new_symtree' or `gfc_get_unique_symtree' to create
the new symtree, depending on the "hidden" argument.

The work is divided as below in the follow-up mails.  The full diff is also
attached to this one.

1/4: Preliminary cleanups.
2/4: Use get_iso_c_binding_dt instead of gfc_get_ha_symbol in gen_cptr_param
3/4: Don't do again name to symbol resolution in gen_special_c_interop_ptr
4/4: (main part) Fix symbol name handling in generate_isocbinding_symbol.

Regression tested on x86_64-unknown-linux-gnu.  Ok for 4.8/4.7 ?

Mikael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr55574_v20-full.diff
Type: text/x-diff
Size: 13365 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20130302/8a539756/attachment.bin>


More information about the Fortran mailing list