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

             Bug #: 54286
           Summary: [4.8 Regression] Accepts invalid proc-pointer
                    assignments involving proc-ptr function result
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: ja...@gcc.gnu.org


The following test is probably invalid, but not rejected by recent trunk
versions:


type :: t
  procedure(a), pointer, nopass :: p
end type

type(t) :: x
procedure(iabs), pointer :: pp

x%p => a     ! ok
x%p => a(1)  ! invalid, but not rejected by 4.8

pp => a(2)   ! ok
pp => a      ! invalid, but not rejected by 4.8

contains

  function a (c) result (b)
    integer, intent(in) :: c
    procedure(iabs), pointer :: b
    b => iabs
  end function

end



gfortran 4.7 rejects it with:

x%p => a(1)
       1
Error: Interface mismatch in procedure pointer assignment at (1): Type/rank
mismatch in return value of 'b'

pp => a
      1
Error: Interface mismatch in procedure pointer assignment at (1): Type/rank
mismatch in return value of 'a'


However, I wonder why one of the errors refers to 'a' and the other to 'b'.
Also I'm not sure whether 'type/rank mismatch' is the correct diagnostic. I
would rather say there is a mismatch in the procedure pointer attribute of the
result (which is not checked for yet), cf. also PR 35831.

Reply via email to