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

commit afb459245da559077a3e4fb7bb905779799d4744
Author: Mikael Morin <mik...@gcc.gnu.org>
Date:   Thu Jul 24 09:44:15 2025 +0200

    Ajout test pr121185
    
    Correction test

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

diff --git a/gcc/testsuite/gfortran.dg/pr121185_comment_23.f90 
b/gcc/testsuite/gfortran.dg/pr121185_comment_23.f90
new file mode 100644
index 000000000000..09bd7486deb6
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr121185_comment_23.f90
@@ -0,0 +1,30 @@
+! { dg-do run }
+
+program p
+  implicit none
+  type t
+     complex, allocatable :: x(:)
+  end type t
+  type, extends (t) :: t2
+  end type t2
+  real :: trace = 2.
+  type(t2) :: z
+  z% x = [1,2] * trace
+  ! print *, z% x
+  if (any(z%x /= [2., 4.])) error stop 1
+  z% x = z% x / trace ! OK
+  !print *, z% x
+  if (any(z%x /= [1., 2.])) error stop 2
+  !print *
+  z% x = [1,2] * trace
+  call norm (z)
+contains
+  subroutine norm (y)
+    class(t2) :: y
+    if (any(z%x /= [2., 4.])) error stop 11
+    ! print *, y% x
+    y% x = y% x / trace ! not OK
+    if (any(z%x /= [1., 2.])) error stop 12
+    ! print *, y% x
+  end subroutine norm
+end

Reply via email to