[Bug fortran/25061] procedure name conflict

dfranke at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Fri May 18 14:49:00 GMT 2007



------- Comment #2 from dfranke at gcc dot gnu dot org  2007-05-18 15:49 -------
I had a short look at this. The problem is in decl.c:693f:

      if (sym->attr.flavor != 0
          && sym->attr.proc != 0
          && (sym->attr.subroutine || sym->attr.function)
          && sym->attr.if_source != IFSRC_UNKNOWN)
        gfc_error_now ("Procedure '%s' at %C is already defined at %L",
                       name, &sym->declared_at);

(gdb) print sym->name
$5 = 0x887e4f6 "i1"
(gdb) print sym->attr.proc
$8 = PROC_UNKNOWN
(gdb) print sym->attr.if_source
$10 = IFSRC_UNKNOWN

Interestingly, if the subroutine I1 is duplicated, the expected error (I1
already defined as interface) is emitted:

$> cat pr25061.f90
MODULE foo
INTERFACE I1
  SUBROUTINE S1(I)
  END SUBROUTINE S1
  SUBROUTINE S2(R)
  END SUBROUTINE S2
END INTERFACE I1
CONTAINS
  SUBROUTINE I1(I)
  END SUBROUTINE I1
  SUBROUTINE I1(R)           ! same as before, but I1 in triplicate now
  END SUBROUTINE I1
END MODULE

$> gfortran-svn -g -Wall 
pr25061.f90:11.15:

  SUBROUTINE I1(R)
              1
pr25061.f90:2.12:

INTERFACE I1
           2
Error: Procedure 'i1' at (1) is already defined at (2)

$> gfortran-svn -v
gcc version 4.3.0 20070517 (experimental)


Adding Paul, The Interface Wizard, Thomas as CC. He will probably now how to
handle this :)


-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dfranke at gcc dot gnu dot
                   |                            |org, pault at gcc dot gnu
                   |                            |dot org


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



More information about the Gcc-bugs mailing list