http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58182

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code
                 CC|                            |janus at gcc dot gnu.org

--- Comment #2 from janus at gcc dot gnu.org ---
There may be other ways to fix this, but a particularly simple one is just
flipping the checks in the if statement which produces the ICE:


Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c    (revision 201834)
+++ gcc/fortran/resolve.c    (working copy)
@@ -10114,11 +10114,11 @@ gfc_verify_binding_labels (gfc_symbol *sym)
        && ((gsym->type != GSYM_SUBROUTINE && gsym->type != GSYM_FUNCTION)
            || (gsym->defined && sym->attr.if_source != IFSRC_IFBODY))
        && sym != gsym->ns->proc_name
-       && (strcmp (gsym->sym_name, sym->name) != 0
-           || module != gsym->mod_name
+       && (module != gsym->mod_name
+           || strcmp (gsym->sym_name, sym->name) != 0
            || (module && strcmp (module, gsym->mod_name) != 0)))
     {
-      /* Print an error if the procdure is defined multiple times; we have to
+      /* Print an error if the procedure is defined multiple times; we have to
      exclude references to the same procedure via module association or
      multiple checks for the same procedure.  */
       gfc_error ("Procedure %s with binding label %s at %L uses the same "


With this I get the following:

mod2.f90:2.6:

  use fg
      1
mod2.f90:1.8:

module f
        2
Error: Procedure f with binding label f at (1) uses the same global identifier
as entity at (2)


This is slightly different from the error message in comment 0, but it still
sounds reasonable to me.


Btw, does it make sense to have a dummy procedure with 'BIND(C)' at all? I have
the feeling that this might be something which should be forbidden in general
... (?)

Reply via email to