summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/array_reference_1.f90
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/array_reference_1.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/array_reference_1.f9035
1 files changed, 35 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/array_reference_1.f90 b/gcc/testsuite/gfortran.dg/array_reference_1.f90
new file mode 100644
index 000000000..6de09919f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/array_reference_1.f90
@@ -0,0 +1,35 @@
+! { dg-do run }
+! Tests the fix for PR31994, aka 31867, in which the offset
+! of 'a' in both subroutines was being evaluated incorrectly.
+! The testcase for PR31867 is char_length_5.f90
+!
+! Contributed by Elizabeth Yip <elizabeth.l.yip@boeing.com>
+! and Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+!
+program main
+ call PR31994
+ call PR31994_comment6
+contains
+ subroutine PR31994
+ implicit none
+ complex (kind=4), dimension(2,2) :: a, b, c
+ a(1,1) = (1.,1.)
+ a(2,1) = (2.,2.)
+ a(1,2) = (3.,3.)
+ a(2,2) = (4.,4.)
+ b=conjg (transpose (a))
+ c=transpose (a)
+ c=conjg (c)
+ if (any (b .ne. c)) call abort ()
+ end subroutine PR31994
+ subroutine PR31994_comment6
+ implicit none
+ real ,dimension(2,2)::a
+ integer ,dimension(2,2) :: b, c
+ a = reshape ((/1.,2.,3.,4./), (/2,2/))
+ b=int (transpose(a))
+ c = int (a)
+ c = transpose (c)
+ if (any (b .ne. c)) call abort ()
+ end subroutine PR31994_comment6
+END program main