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/37583] ICE "insert_bbt(): Duplicate key" for self-calling ENTRY subprogram



------- Comment #2 from pault at gcc dot gnu dot org  2008-09-19 09:00 -------
Hah!  I never did like ENTRY in Modules:-(

Changing the actual argument reference to 'glocal' to appear after the ENTRY,
by use of a GOTO, allows the horror below to run correctly.

Thus, in the reporter's version, the symbol for glocal that is generated by the
call to mysub is not being detected until the attempt to create the ENTRY
symbol, whereupon the symtree 'glocal' is found to be a duplicate.

The version below still misses the requirement that sub be RECURSIVE.

Confirmed

Paul

module gsub
contains
  recursive subroutine sub( g )
    interface
      real function g(x)
        real x
      end function
    end interface
    interface
      subroutine mysub(proc)
        interface
          recursive subroutine proc(x, y)
            real x, y
          end subroutine
        end interface
      end subroutine
    end interface
    real :: x, y
    go to 100               ! Putting the reference to 'glocal'
  entry glocal( x, y )      ! after the ENTRY is OK.
    print *, "         glocal(x,y)", x, y
    return
100    call mysub( glocal ) ! ....here
    print *, "Check call to g(x)", g(21.0)
  end subroutine
end module

  use gsub
  interface
    real function fcn(x)
      real x
    end function
  end interface
  print *, "Direct call of...."
  call glocal (1.0, 2.0)
  print *, "Call via 'sub' of...."
  call sub (fcn)
end

subroutine mysub(proc)
  interface
    recursive subroutine proc(x, y)
      real x, y
    end subroutine
  end interface
  call proc (3.0, 4.0)
end subroutine

real function fcn (x)
  real x
  fcn = 2.0 * x
end function


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-09-19 09:00:39
               date|                            |


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


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