This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/17911] New: ice: wrongly resolved ambguity between generic function and local variable


[tobi@marktplatz tests]$ cat generic.f90
module t
  interface a
     module procedure b
  end interface
contains
  integer function b(x)
    b = x
  end function b
end module t

subroutine r
  use t

  b = 1.
  y = a(1.)
end subroutine r
[tobi@marktplatz tests]$ ~/src/gcc/build-clean/gcc/f951 generic.f90
 b
 r

generic.f90:11: internal compiler error: in gfc_conv_variable, at
/fortran/trans-expr.c:319
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

>From -fdump-parse-tree (namespace dump for subroutine r):
        Namespace: A-H: (REAL 4) I-N: (INTEGER 4) O-Z: (REAL 4)
        procedure name = r
        symtree: y  Ambig 0
        symbol y (REAL 4)(VARIABLE UNKNOWN-INTENT UNKNOWN-ACCESS UNKNOWN-PROC
IMPLICIT-TYPE)

        symtree: a  Ambig 0
        symbol a (UNKNOWN 0)(PROCEDURE UNKNOWN-INTENT UNKNOWN-ACCESS
UNKNOWN-PROC USE-ASSOC)
        Generic interfaces: b

        symtree: b  Ambig 0
        symbol b (INTEGER 4)(PROCEDURE UNKNOWN-INTENT UNKNOWN-ACCESS MODULE-PROC
USE-ASSOC FUNCTION)
        result: b
        Formal arglist: x
        Formal namespace
          Namespace: A-H: (REAL 4) I-N: (INTEGER 4) O-Z: (REAL 4)
          procedure name = b
          symtree: @0  Ambig 0
          symbol x (REAL 4)(VARIABLE UNKNOWN-INTENT UNKNOWN-ACCESS UNKNOWN-PROC
DUMMY USE-ASSOC)

        symtree: r  Ambig 0
        symbol r (UNKNOWN 0)(PROCEDURE UNKNOWN-INTENT UNKNOWN-ACCESS
UNKNOWN-PROC SUBROUTINE)

        symtree: t  Ambig 0
        symbol t (UNKNOWN 0)(MODULE UNKNOWN-INTENT UNKNOWN-ACCESS UNKNOWN-PROC
USE-ASSOC)


      ASSIGN b 1
      ASSIGN y __convert_i4_r4[[((b[[((1.000000))]]))]]

 r

There's only one symbol b, and apparently no difference is made between them.

The assertion is:
299:  sym = expr->symtree->n.sym;
300:  if (se->ss != NULL)
301:    {
...
311:   else
312:    {
...
316:      if (sym->attr.flavor == FL_PROCEDURE
317:	      && se->expr != current_function_decl)
318:	    {
319:	      gcc_assert (se->want_pointer); /////////// HERE

So it tries to deal with a procedure symbol as if it were a variable, which
supports the previous analysis

-- 
           Summary: ice: wrongly resolved ambguity between generic function
                    and local variable
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tobi at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]