aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/parameter_array_section_2.f90
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/parameter_array_section_2.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/parameter_array_section_2.f9014
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/parameter_array_section_2.f90 b/gcc/testsuite/gfortran.dg/parameter_array_section_2.f90
new file mode 100644
index 00000000000..aa212c050fa
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/parameter_array_section_2.f90
@@ -0,0 +1,14 @@
+! { dg-do run }
+! { dg-options "-O" }
+! Test the fix for PR31011 in which the length of the array sections
+! with stride other than unity were incorrectly calculated.
+!
+! Contributed by <terry@chem.gu.se>
+!
+program PotentialMatrix
+ implicit none
+ real(kind=8),dimension(2),parameter::v2=(/1,2/)
+ real(kind=8),dimension(4),parameter::v4=(/1,2,3,4/)
+ if (any (v2*v4(1:3:2) .ne. (/1,6/))) call abort ()
+ if (any (v2*v4(3:1:-2) .ne. (/3,2/))) call abort ()
+end