https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109948
--- Comment #11 from anlauf at gcc dot gnu.org ---
(In reply to Paul Thomas from comment #9)
> By the way, the patch regtests OK
>
> Do you want to do the honours or shall I?
>
> I think that this rates as an 'obvious' fix.
I think it does not handle the following variation of the testcase from
the blamed patch:
module mm
implicit none
interface operator(==)
module procedure eq_1_2
end interface operator(==)
private :: eq_1_2
contains
logical function eq_1_2 (x, y)
integer, intent(in) :: x(:)
real, intent(in) :: y(:,:)
eq_1_2 = .true.
end function eq_1_2
end module mm
subroutine foo(k_2d)
use mm
implicit none
integer :: k_2d(:)
integer :: m(1) = 42
real :: r(1,1) = 3.0
print *, (m == r)
associate (k=>k_2d)
print *, (k == r) ! <-- fails
end associate
associate (k=>k_2d(:))
print *, (k == r)
end associate
end subroutine foo
For the marked line, I see in the debugger that e->ref == NULL.
I've played with some modification of the related code block, but that
regressed on two of the associate testcases.