This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH gfortran v2] PR 61450: ICE in gfc_global_used()
- From: Dominique d'Humières <dominiq at lps dot ens dot fr>
- To: FX <fxcoudert at gmail dot com>
- Cc: Thomas Koenig <tkoenig at netcologne dot de>, gfortran <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 30 Sep 2017 14:21:39 +0200
- Subject: Re: [PATCH gfortran v2] PR 61450: ICE in gfc_global_used()
- Authentication-results: sourceware.org; auth=none
- References: <3DFB4E8F-3B15-4A07-B090-C184C89965C5@lps.ens.fr>
As noticed by Thomas on IRC, the FX's patch may not be translator friendly. I have now tested the following
--- ../_clean/gcc/fortran/parse.c 2017-09-01 19:00:10.000000000 +0200
+++ gcc/fortran/parse.c 2017-09-28 17:55:14.000000000 +0200
@@ -5742,16 +5742,28 @@ gfc_global_used (gfc_gsymbol *sym, locus
name = "MODULE";
break;
default:
- gfc_internal_error ("gfc_global_used(): Bad type");
name = NULL;
}
- if (sym->binding_label)
- gfc_error ("Global binding name %qs at %L is already being used as a %s "
- "at %L", sym->binding_label, where, name, &sym->where);
+ if (name)
+ {
+ if (sym->binding_label)
+ gfc_error ("Global binding name %qs at %L is already being used "
+ "as a %s at %L", sym->binding_label, where, name,
+ &sym->where);
+ else
+ gfc_error ("Global name %qs at %L is already being used as "
+ "a %s at %L", sym->name, where, name, &sym->where);
+ }
else
- gfc_error ("Global name %qs at %L is already being used as a %s at %L",
- sym->name, where, name, &sym->where);
+ {
+ if (sym->binding_label)
+ gfc_error ("Global binding name %qs at %L is already being used "
+ "at %L", sym->binding_label, where, &sym->where);
+ else
+ gfc_error ("Global name %qs at %L is already being used at %L",
+ sym->name, where, &sym->where);
+ }
}
I have also tried to avoid the nested IFs following the Thomas’ suggestion to use
label = sym->binding_label ? sym->binding_label : sym->name;
but this does not handle "Global binding name "/"Global name ».
Dominique
> Le 24 sept. 2017 à 16:13, Dominique d'Humières <dominiq@lps.ens.fr> a écrit :
>
> Rebased FX’s patch.
>
> Tested on x86_64-apple-darwin16.Is it OK with the proper log entries added?
>
> TIA
>
> Dominique