[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-patches
Subject:    Re: [PATCH gfortran v2] PR 61450: ICE in gfc_global_used()
From:       Dominique_d'Humières <dominiq () lps ! ens ! fr>
Date:       2017-09-30 12:21:39
Message-ID: BC5AD4CB-90F0-402D-A7D0-33DAD2CE09A4 () lps ! ens ! fr
[Download RAW message or body]

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic