public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH gfortran] PR 61450: ICE in gfc_global_used()
@ 2017-09-24 14:13 Dominique d'Humières
  2017-09-30 12:21 ` [PATCH gfortran v2] " Dominique d'Humières
  0 siblings, 1 reply; 4+ messages in thread
From: Dominique d'Humières @ 2017-09-24 14:13 UTC (permalink / raw)
  To: FX; +Cc: Thomas Koenig, gfortran, gcc-patches

Rebased FX’s patch.

Tested on x86_64-apple-darwin16.Is it OK with the proper log entries added?

TIA

Dominique

diff -up ../_clean/gcc/fortran/parse.c gcc/fortran/parse.c
--- ../_clean/gcc/fortran/parse.c	2017-01-22 20:50:56.000000000 +0100
+++ gcc/fortran/parse.c	2017-01-24 10:01:32.000000000 +0100
@@ -5724,34 +5724,33 @@ gfc_global_used (gfc_gsymbol *sym, locus
   switch(sym->type)
     {
     case GSYM_PROGRAM:
-      name = "PROGRAM";
+      name = "as a PROGRAM ";
       break;
     case GSYM_FUNCTION:
-      name = "FUNCTION";
+      name = "as a FUNCTION ";
       break;
     case GSYM_SUBROUTINE:
-      name = "SUBROUTINE";
+      name = "as a SUBROUTINE ";
       break;
     case GSYM_COMMON:
-      name = "COMMON";
+      name = "as a COMMON ";
       break;
     case GSYM_BLOCK_DATA:
-      name = "BLOCK DATA";
+      name = "as a BLOCK DATA ";
       break;
     case GSYM_MODULE:
-      name = "MODULE";
+      name = "as a MODULE ";
       break;
     default:
-      gfc_internal_error ("gfc_global_used(): Bad type");
-      name = NULL;
+      name = "";
     }
 
   if (sym->binding_label)
-    gfc_error ("Global binding name %qs at %L is already being used as a %s "
+    gfc_error ("Global binding name %qs at %L is already being used %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);
+    gfc_error ("Global name %qs at %L is already being used %s"
+	       "at %L", sym->name, where, name, &sym->where);
 }
 
 
--- ../_clean/gcc/testsuite/gfortran.dg/binding_label_tests_28.f90	1970-01-01 01:00:00.000000000 +0100
+++ gcc/testsuite/gfortran.dg/binding_label_tests_28.f90	2017-01-13 17:32:01.000000000 +0100
@@ -0,0 +1,12 @@
+! { dg-do compile }
+!
+! PR fortran/61450
+! Contributed by Francois-Xavier Coudert  <fxcoudert@gmail.com>
+!
+module p
+  integer i1 ! { dg-error "Global binding name 'foo' at .1. is already being used at .2." }
+  bind(c,name="foo") :: i1
+end module
+
+subroutine truc() bind(c,name="foo") ! { dg-error "Global binding name 'foo' at .1. is already being used at .2." }
+end

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-10-01 10:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-24 14:13 [PATCH gfortran] PR 61450: ICE in gfc_global_used() Dominique d'Humières
2017-09-30 12:21 ` [PATCH gfortran v2] " Dominique d'Humières
2017-10-01  8:38   ` Thomas Koenig
2017-10-01 10:03     ` Dominique d'Humières

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).