This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [Patch, fortran] PR 51808 Heap allocate binding labels
- From: Tobias Burnus <tobias dot burnus at physik dot fu-berlin dot de>
- To: Janne Blomqvist <blomqvist dot janne at gmail dot com>, gcc-patches at gcc dot gnu dot org, fortran at gcc dot gnu dot org
- Date: Wed, 18 Jan 2012 10:12:37 +0100
- Subject: Re: [Patch, fortran] PR 51808 Heap allocate binding labels
Dear Janne,
> the attached patch changes the binding labels that are needed for
> bind(C) symbols to be heap allocated rather than, as currently, being
> fixed size arrays of size 127 (or 64 in module.c!?).
wonder whether it would have been smarter to use string matching rather
than the manual matching in gfc_match_name_C to obtain longer strings.
(Cf. PR 36275. Different but related binding label issue: PR 38839.)
On the other hand, that's separate issues, deserving patches on their own.
> --- a/gcc/fortran/resolve.c
> +++ b/gcc/fortran/resolve.c
> @@ -2744,14 +2747,16 @@ gfc_iso_c_func_interface (gfc_symbol *sym,
> {
> /* two args. */
> sprintf (name, "%s_2", sym->name);
> - sprintf (binding_label, "%s_2", sym->binding_label);
> + if (sym->binding_label)
> + sprintf (binding_label, "%s_2", sym->binding_label);
> optional_arg = 1;
I wonder whether one can get rid of all those binding names. I think
they date back to the time when a libgfortran function was called for
ISOCBINDING_ASSOCIATED instead of just generating in trans-intrinsics.c
one (ptr != NULL) or two (ptr != NULL && ptr == tgt) pointer comparisons.
I also believe that C_LOC and C_FUNLOC are (now) handled in
trans-intrinsics.c. Thus, you could confirm that no binding name is
needed and remove them.
Otherwise, the patch looks relatively mechnical and is OK.
Tobias