This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

Re: [PATCH gfortran v2] PR 61450: ICE in gfc_global_used()


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


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