public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/39930]  New: Bogus error: ambiguous reference
@ 2009-04-27 13:25 janus at gcc dot gnu dot org
  2009-04-27 16:55 ` [Bug fortran/39930] " janus at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-04-27 13:25 UTC (permalink / raw)
  To: gcc-bugs

Consider the following set of modules:


module a1
contains
  subroutine myRoutine
  end subroutine
end module 

module a2
contains
  subroutine myRoutine
  end subroutine
end module 

module b
contains

  subroutine otherRoutine
    use a1
    use a2
    call myRoutine              ! this is ambiguous !
  end subroutine

  subroutine myRoutine
  end subroutine myRoutine      ! this is not ambiguous !

end module


Feeding this to gfortran gives two errors:

all.f90:19.18:

    call myRoutine  ! this is ambiguous !
                  1
Error: Name 'myroutine' at (1) is an ambiguous reference to 'myroutine' from
module 'a1'
all.f90:23.52:

  end subroutine myRoutine ! this is not ambiguous !
                                                    1
Error: Name 'myroutine' at (1) is an ambiguous reference to 'myroutine' from
module 'a1'

This first error is ok, the second is bogus. Same for all gfortran versions I
tried (4.3.3, 4.4.0 and trunk).


-- 
           Summary: Bogus error: ambiguous reference
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: janus at gcc dot gnu dot org
  GCC host triplet: x86_64-unknown-linux-gnu


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


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

* [Bug fortran/39930] Bogus error: ambiguous reference
  2009-04-27 13:25 [Bug fortran/39930] New: Bogus error: ambiguous reference janus at gcc dot gnu dot org
@ 2009-04-27 16:55 ` janus at gcc dot gnu dot org
  2009-04-28  9:45 ` janus at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-04-27 16:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from janus at gcc dot gnu dot org  2009-04-27 16:54 -------
Something like this should do it:

Index: gcc/fortran/parse.c
===================================================================
--- gcc/fortran/parse.c (Revision 146826)
+++ gcc/fortran/parse.c (Arbeitskopie)
@@ -3310,7 +3310,7 @@ gfc_fixup_sibling_symbols (gfc_symbol *s
   sym->attr.referenced = 1;
   for (ns = siblings; ns; ns = ns->sibling)
     {
-      gfc_find_sym_tree (sym->name, ns, 0, &st);
+      st = gfc_find_symtree (ns->sym_root, sym->name);

       if (!st || (st->n.sym->attr.dummy && ns == st->n.sym->ns))
        goto fixup_contained;

It seems a bit unfortunate that we have two functions with almost the same name
(gfc_find_sym_tree and gfc_find_symtree), which do almost the same, but not
quite. The little difference is important here. Maybe one of these functions
should be renamed to make the usage clearer?


-- 


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


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

* [Bug fortran/39930] Bogus error: ambiguous reference
  2009-04-27 13:25 [Bug fortran/39930] New: Bogus error: ambiguous reference janus at gcc dot gnu dot org
  2009-04-27 16:55 ` [Bug fortran/39930] " janus at gcc dot gnu dot org
@ 2009-04-28  9:45 ` janus at gcc dot gnu dot org
  2009-04-28  9:46 ` janus at gcc dot gnu dot org
  2009-04-28 10:51 ` janus at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-04-28  9:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from janus at gcc dot gnu dot org  2009-04-28 09:44 -------
Subject: Bug 39930

Author: janus
Date: Tue Apr 28 09:44:36 2009
New Revision: 146880

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=146880
Log:
2009-04-28  Janus Weil  <janus@gcc.gnu.org>

        PR fortran/39930
        PR fortran/39931
        * expr.c (gfc_check_pointer_assign): Correctly detect if the left hand
        side is a pointer.
        * parse.c (gfc_fixup_sibling_symbols): Don't check for ambiguity.


2009-04-28  Janus Weil  <janus@gcc.gnu.org>

        PR fortran/39930
        PR fortran/39931
        * gfortran.dg/ambiguous_reference_2.f90: New.
        * gfortran.dg/pointer_assign_7.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/ambiguous_reference_2.f90
    trunk/gcc/testsuite/gfortran.dg/pointer_assign_7.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/expr.c
    trunk/gcc/fortran/parse.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/39930] Bogus error: ambiguous reference
  2009-04-27 13:25 [Bug fortran/39930] New: Bogus error: ambiguous reference janus at gcc dot gnu dot org
  2009-04-27 16:55 ` [Bug fortran/39930] " janus at gcc dot gnu dot org
  2009-04-28  9:45 ` janus at gcc dot gnu dot org
@ 2009-04-28  9:46 ` janus at gcc dot gnu dot org
  2009-04-28 10:51 ` janus at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-04-28  9:46 UTC (permalink / raw)
  To: gcc-bugs



-- 

janus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |janus at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-04-28 09:46:03
               date|                            |


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


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

* [Bug fortran/39930] Bogus error: ambiguous reference
  2009-04-27 13:25 [Bug fortran/39930] New: Bogus error: ambiguous reference janus at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2009-04-28  9:46 ` janus at gcc dot gnu dot org
@ 2009-04-28 10:51 ` janus at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-04-28 10:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from janus at gcc dot gnu dot org  2009-04-28 10:50 -------
Fixed with r146880. Closing.


-- 

janus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2009-04-28 10:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-27 13:25 [Bug fortran/39930] New: Bogus error: ambiguous reference janus at gcc dot gnu dot org
2009-04-27 16:55 ` [Bug fortran/39930] " janus at gcc dot gnu dot org
2009-04-28  9:45 ` janus at gcc dot gnu dot org
2009-04-28  9:46 ` janus at gcc dot gnu dot org
2009-04-28 10:51 ` janus at gcc dot gnu dot org

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).