[Bug fortran/53956] New: Proc-pointer w/ interface: Bogus "EXTERNAL attribute conflicts with FUNCTION attribute"

burnus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jul 13 18:26:00 GMT 2012


             Bug #: 53956
           Summary: Proc-pointer w/ interface: Bogus "EXTERNAL attribute
                    conflicts with FUNCTION attribute"
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org
                CC: janus@gcc.gnu.org

Found at comp.lang.fortran,
cf. http://www.rhinocerus.net/forum/lang-fortran/709699-sort-2d-matrix-2.html

The original example has been written by James Van Buskirk - see thread.

The following program gives the bogus error when the procedure pointer is
invoked. Without procedure pointer or - for the dummy argument - using
"procedure(integer)" instead of "integer, external" (which is semantically
identically), works.

program testme
Error: EXTERNAL attribute conflicts with FUNCTION attribute in 'comparator2' at

module m
  function compare()
    integer :: compare
    compare = 42
  end function compare
  subroutine print_it(x)
    procedure(integer) :: x
    print *, x()
  end subroutine print_it
end module m

program testme
  use m
  implicit none
    subroutine sub(comparator2)        ! <<< related to those
      integer, external :: comparator2 ! <<< lines
    end subroutine sub
  end interface
  procedure(sub), pointer :: fp  ! << but the interface might be involved
  fp => print_it
  call fp (compare)   ! <<< Triggers the error
end program testme

More information about the Gcc-bugs mailing list