From: Dominique d'Humieres Date: Sun, 1 Oct 2017 09:49:48 +0000 (+0200) Subject: re PR fortran/61450 (ICE in gfc_global_used()) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=efa1d7a21633c6e2e66245a11ba4347baf3d1767;p=gcc.git re PR fortran/61450 (ICE in gfc_global_used()) 2017-10-01 Dominique d'Humieres PR fortran/61450 * parse.c (gfc_global_used): Replace the gfc_internal_error with an error. 2017-10-01 Dominique d'Humieres PR fortran/61450 * gfortran.dg/binding_label_tests_28.f90: New test. From-SVN: r253328 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index b0c9c808cb4..b5eea8770a4 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2017-10-01 Dominique d'Humieres + + PR fortran/61450 + * parse.c (gfc_global_used): Replace the gfc_internal_error + with an error. + 2017-09-29 Dominique d'Humieres PR fortran/25071 diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c index e958e6db31e..eb0f92e734b 100644 --- a/gcc/fortran/parse.c +++ b/gcc/fortran/parse.c @@ -5742,16 +5742,28 @@ gfc_global_used (gfc_gsymbol *sym, locus *where) 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); + } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fcf901a6a4d..40f59343fe1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-10-01 Dominique d'Humieres + + PR fortran/61450 + * gfortran.dg/binding_label_tests_28.f90: New test. + 2017-09-30 Paolo Carlini PR c++/65949 diff --git a/gcc/testsuite/gfortran.dg/binding_label_tests_28.f90 b/gcc/testsuite/gfortran.dg/binding_label_tests_28.f90 new file mode 100644 index 00000000000..0066a4ac876 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/binding_label_tests_28.f90 @@ -0,0 +1,12 @@ +! { dg-do compile } +! +! PR fortran/61450 +! Contributed by Francois-Xavier Coudert +! +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