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

            Bug ID: 125481
           Summary: [generic] Wrong generic resolution between procedure
                    pointer and variable actuals of same TKR
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pault at gcc dot gnu.org
  Target Milestone: ---

Created attachment 64566
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=64566&action=edit
Regression free patch

This bug was found while debugging formal. The attached fix by Jerry Delisle,
using Claude AI, regtests OK.

I would recommend that before submission, the testcase be renamed
generic_37.f90 because there is already a generic_22.f03.

Also, both versions of the generic should be tested using:
program test
  use m
  implicit none
  procedure (init_i), pointer :: f => identity
  type (t) :: x
  integer :: i

  x = make_t (f, 4)
  do i = 1, 4
    if (abs (x%vals(i) - real (i, 8)) > epsilon (x%vals(i))) STOP 1
  end do

  x = make_t (42.0d0, 4)
  if (any (abs (x%vals - 42.0d0) > epsilon (x%vals(1)))) stop 2

end program test

Paul

Reply via email to