Consider the following (supposedly valid) code:

MODULE error_stack_module
  implicit none

  type,abstract::serializable_class
   contains
     procedure(ser_DTV_RF),deferred::read_formatted
  end type serializable_class

  abstract interface
     subroutine ser_DTV_RF(dtv,unit,iotype,v_list,iostat,iomsg)
       import serializable_class
       CLASS(serializable_class),INTENT(INOUT) :: dtv
       INTEGER, INTENT(IN) :: unit
       CHARACTER (LEN=*), INTENT(IN) :: iotype
       INTEGER, INTENT(IN) :: v_list(:)
       INTEGER, INTENT(OUT) :: iostat
       CHARACTER (LEN=*), INTENT(INOUT) :: iomsg
     end subroutine ser_DTV_RF
  end interface

  type,extends(serializable_class)::error_type
     class(error_type),pointer::next=>null()
   contains
     procedure::read_formatted=>error_read_formatted
  end type error_type

contains

  recursive subroutine
error_read_formatted(dtv,unit,iotype,v_list,iostat,iomsg)
    CLASS(error_type),INTENT(INOUT) :: dtv
    INTEGER, INTENT(IN) :: unit
    CHARACTER (LEN=*), INTENT(IN) :: iotype
    INTEGER, INTENT(IN) :: v_list(:)
    INTEGER, INTENT(OUT) :: iostat
    CHARACTER (LEN=*), INTENT(INOUT) :: iomsg
    character(8),allocatable::type
    character(8),allocatable::next
    call basic_read_string(unit,type)
    call basic_read_string(unit,next)
    if(next=="NEXT")then
       allocate(dtv%next)
       call dtv%next%read_formatted(unit,iotype,v_list,iostat,iomsg)
    end if
  end subroutine error_read_formatted

 end MODULE error_stack_module


With current trunk, compilation results in:


error_stack.f03:25.14:

     procedure::read_formatted=>error_read_formatted
              1
Error: Passed-object dummy argument of 'error_read_formatted' at (1) must not
be POINTER
error_stack.f03:22.46:

  type,extends(serializable_class)::error_type
                                              1
Error: Derived-type 'error_type' declared at (1) must be ABSTRACT because
'read_formatted' is DEFERRED and not overridden
f951: internal compiler error: in resolve_class_esym, at fortran/resolve.c:5255


The first error message is apparently bogus, the second one seems to be a
consequence of the first one. The ICE may be a separate issue.


-- 
           Summary: [OOP] Bogus error: Passed-object dummy argument must not
                    be POINTER
           Product: gcc
           Version: 4.6.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


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

Reply via email to