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

commit f538eea18822e04abd10954a4f7201c87e144a4f
Author: Mikael Morin <[email protected]>
Date:   Thu Nov 19 20:52:12 2026 +0100

    Ajout test

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

diff --git a/gcc/testsuite/gfortran.dg/is_contiguous_8.f90 
b/gcc/testsuite/gfortran.dg/is_contiguous_8.f90
new file mode 100644
index 000000000000..a9f80844d95d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/is_contiguous_8.f90
@@ -0,0 +1,28 @@
+! { dg-do run }
+!
+! PR fortran/128857
+! Check that the dynamic type is taken into account when initializing array
+! descriptors.  The element length of the temporary descriptor to implement
+! the call to IS_CONTIGUOUS intrinsic used to be set to that of T1 instead of
+! that of T2, causing IS_CONTIGUOUS to return the wrong result.
+
+program prog
+   implicit none
+   integer, parameter :: n = 5
+   type :: t1
+      integer :: c1, c2
+   end type
+   type, extends(t1) :: t2
+      integer :: c3
+   end type
+   type(t2), target :: a(n)
+   integer :: i
+   a = [ (t2(1, 2, 3), i=1,n) ]
+   call sub(a)
+contains
+   subroutine sub(x)
+      class(t1), target, intent(in) :: x(:)
+      if (.not. is_contiguous(x)) error stop 1
+   end subroutine
+end program
+

Reply via email to