https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61615

            Bug ID: 61615
           Summary: Failure to resolve correct generic with TYPE(C_PTR)
                    arguments
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: thatcadguy at gmail dot com

The following program does not produce the expected output (the line 'CALL
bar(a, b)' does not choose the subroutine bar_s as it should, it chooses
bar_a1d):

MODULE foo
  USE iso_c_binding
  IMPLICIT NONE
  INTERFACE bar
    MODULE PROCEDURE bar_s
    MODULE PROCEDURE bar_a1d
  END INTERFACE bar
CONTAINS
  SUBROUTINE bar_s(a, b)
    TYPE(c_ptr) :: a, b
    WRITE (0, *) 'in bar_s'
  END SUBROUTINE bar_s

  SUBROUTINE bar_a1d(a, b)
    TYPE(c_ptr) :: a(:), b(:)
    WRITE (0, *) 'in bar_a1d'
  END SUBROUTINE bar_a1d
END MODULE foo

PROGRAM cptr_array_vs_scalar_arg
  USE foo
  USE iso_c_binding
  IMPLICIT NONE
  INTEGER, TARGET :: i
  TYPE(c_ptr) :: a, b
  a = C_LOC(i)
  b = C_LOC(i)
  CALL bar(a, b)
END PROGRAM cptr_array_vs_scalar_arg

Reply via email to