https://gcc.gnu.org/g:e74b8552be45175476a319f717610e21db0bddbc

commit e74b8552be45175476a319f717610e21db0bddbc
Author: Mikael Morin <[email protected]>
Date:   Tue Oct 6 12:48:51 2026 +0200

    Ajout test

Diff:
---
 gcc/testsuite/gfortran.dg/contiguous_19.f90 | 34 +++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/gcc/testsuite/gfortran.dg/contiguous_19.f90 
b/gcc/testsuite/gfortran.dg/contiguous_19.f90
new file mode 100644
index 000000000000..b2d540fab918
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/contiguous_19.f90
@@ -0,0 +1,34 @@
+! { dg-do compile }
+!
+! PR fortran/127613
+! Check that simply contiguous polymorphic arrays are correctly recognized as
+! such, and that the information correctly propagates to associate names.
+! The associate names used as pointer association target below used to not be
+! recognized as simply contiguous.
+
+program prog
+   implicit none
+   integer, parameter :: n = 3
+   type :: t
+      integer :: c
+   end type
+   type(t), allocatable, target :: x(:,:)
+   integer :: i
+   x = reshape([ (t(i*i), i=1,n*n) ], [n,n])
+   call sub(x)
+contains
+   subroutine sub(y)
+      class(t), contiguous, target  :: y(:,:)
+      class(t), contiguous, pointer :: p(:,:)
+      class(t), pointer :: q(:)
+      q(1:n*n) => y
+      associate (a => y)
+         q(1:n*n) => a
+      end associate
+      p => y
+      q(1:n*n) => p
+      associate (b => p)
+         q(1:n*n) => b
+      end associate
+   end subroutine
+end program

Reply via email to