https://gcc.gnu.org/g:03290589ea862abd23788824e73c6454c14b9776
commit 03290589ea862abd23788824e73c6454c14b9776 Author: Mikael Morin <[email protected]> Date: Tue Nov 17 18:07:33 2026 +0100 Ajout test Diff: --- gcc/testsuite/gfortran.dg/assumed_rank_27.f90 | 39 +++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/gcc/testsuite/gfortran.dg/assumed_rank_27.f90 b/gcc/testsuite/gfortran.dg/assumed_rank_27.f90 new file mode 100644 index 000000000000..a3574c70baae --- /dev/null +++ b/gcc/testsuite/gfortran.dg/assumed_rank_27.f90 @@ -0,0 +1,39 @@ +! { dg-do run } +! +! Check that scalar values are correctly passed to polymorphic assumed-rank +! dummy arguments. + +program prog + implicit none + integer, parameter :: n = 5 + type :: t + integer :: c + end type + class(t), allocatable :: a(:) + integer :: i + allocate(a(n)) + do i=1,n + a(i)%c = i*i + end do + call sub(a(2), 4, 1) + call sub(a(3), 9, 2) + call sub(a(5), 25, 3) +contains + subroutine sub(x, y, e) + class(t), intent(in) :: x(..) + integer, intent(in) :: y, e + select rank(x) + rank (0) + call check(x%c, y, e*10+1) + rank default + call check(rank(x), 0, e*10+2) + end select + end subroutine + subroutine check(x, y, e) + integer, intent(in) :: x, y, e + if (x /= y) then + print *, e, "FAIL", x, y + error stop e + end if + end subroutine +end program prog
