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

             Bug #: 51790
           Summary: Broken ambiguity check when combining generic with
                    nongeneric procedures
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid, diagnostic
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: bur...@gcc.gnu.org
            Blocks: 51578


Another bug which blocks my progress with PR 51578.

If one compiles
  gfortran.dg/generic_11.f90
one gets the error:
  call foo ! { dg-error "is an ambiguous reference" } 
          1
  Error: Name 'foo' at (1) is an ambiguous reference to 'foo' from module
'm_foo'

However, if one swaps the order of
  use m_foo
  use m_bar
no error is printed.

The reason is that in symbol's gfc_find_sym_tree one has the check:
          if (st->ambiguous && !st->n.sym->attr.generic)
            {
              ambiguous_symbol (name, st);

However, one of the "foo" is generic and the other isn't. Thus, depending which
one is first in the symtree, an error is printed or not.

Reply via email to