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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |ice-on-invalid-code,
                   |                            |rejects-valid
   Last reconfirmed|                            |2010.12.15 08:25:18
                 CC|                            |burnus at gcc dot gnu.org,
                   |                            |janus at gcc dot gnu.org
     Ever Confirmed|0                           |1
            Summary|Spurious "recursive call"   |[OOP] Spurious "recursive
                   |error with type bound       |call" error with type bound
                   |procedure                   |procedure

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2010-12-15 
08:25:18 UTC ---
At a glance it looks valid to me. The crucial part seems to be:

  PROCEDURE(relay_proc), DEFERRED :: TwoProc
...
  SUBROUTINE relay_proc(obj)
    CALL obj%TwoProc
                    1
Error: SUBROUTINE 'relay_proc' at (1) cannot be called recursively, as it is
not RECURSIVE

  *  *  *

I managed to create an ICE-on-invalid-code: The following program segfaults w/o
printing any error/warning message at

==31463== Invalid read of size 1
==31463==    at 0x50871E: gfc_match_varspec (primary.c:1771)
==31463==    by 0x4F06A3: gfc_match_call (match.c:3442)
==31463==    by 0x501622: match_word (parse.c:65)


The following program is invalid for several reasons: the ICE seems to be due
to "bar" having no dummy argument. If one adds one, one gets the bogus
"recursive" error; fixing that one gets the correct error that the argument
must be of type CLASS(t2) and not of CLASS(t).

module m
  type, abstract :: t
  contains
    procedure(bar), pass, deferred :: foo
    procedure(bar), pass, deferred :: bar
  end type
  type,extends(t) :: t2
  contains
    procedure, pass :: bar => bar
    procedure, pass :: foo => foo
  end type t2
contains
  subroutine foo(this)
    class(t) :: this
  end subroutine foo
  subroutine bar()   ! pass but "this" argument is missing; no error only ICE
    class(t) :: this
    call this%foo()
  end subroutine
end module m

Reply via email to