aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2009-05-25 03:07:00 +0000
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2009-05-25 03:07:00 +0000
commit7ac6195704c2c071d24d43f36e292041cf65c9e3 (patch)
treeaddb86e9ecb9c6288fb90687361d529dbd351acc
parentea74392e0926b55a8587c3aa2ea3f92a2ec3529a (diff)
downloadgcc-7ac6195704c2c071d24d43f36e292041cf65c9e3.zip
gcc-7ac6195704c2c071d24d43f36e292041cf65c9e3.tar.gz
gcc-7ac6195704c2c071d24d43f36e292041cf65c9e3.tar.bz2
Dominique Dhumieres
2009-05-24 Jerry DeLisle <jvdelisle@gcc.gnu.org> Dominique Dhumieres PR fortran/35732 PR fortran/39872 * trans-array.c (gfc_conv_ss_startstride): Add one to index. * gfortran.dg/bounds_check_fail_3.f90: New test. * gfortran.dg/bounds_check_fail_4.f90: New test. * gfortran.dg/bounds_check_14.f90: Update test. * gfortran.dg/bound_4.f90: Update test. From-SVN: r147842
-rw-r--r--gcc/fortran/ChangeLog7
-rw-r--r--gcc/fortran/trans-array.c2
-rw-r--r--gcc/testsuite/ChangeLog10
-rw-r--r--gcc/testsuite/gfortran.dg/bound_4.f906
-rw-r--r--gcc/testsuite/gfortran.dg/bounds_check_14.f906
-rw-r--r--gcc/testsuite/gfortran.dg/bounds_check_fail_3.f9012
-rw-r--r--gcc/testsuite/gfortran.dg/bounds_check_fail_4.f9012
7 files changed, 49 insertions, 6 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 41db00e..61278ba 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,10 @@
+2009-05-24 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+ Dominique Dhumieres
+
+ PR fortran/35732
+ PR fortran/39872
+ * trans-array.c (gfc_conv_ss_startstride): Add one to index.
+
2009-05-22 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/40195
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index f4276ca..36a99a4 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -3256,6 +3256,8 @@ gfc_conv_ss_startstride (gfc_loopinfo * loop)
info->start[n]);
tmp = fold_build2 (FLOOR_DIV_EXPR, gfc_array_index_type, tmp,
info->stride[n]);
+ tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type,
+ gfc_index_one_node, tmp);
tmp = fold_build2 (MAX_EXPR, gfc_array_index_type, tmp,
build_int_cst (gfc_array_index_type, 0));
/* We remember the size of the first section, and check all the
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index cbfaf21..e0907db 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,13 @@
+2009-05-24 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+ Dominique Dhumieres
+
+ PR fortran/35732
+ PR fortran/39872
+ * gfortran.dg/bounds_check_fail_3.f90: New test.
+ * gfortran.dg/bounds_check_fail_4.f90: New test.
+ * gfortran.dg/bounds_check_14.f90: Update test.
+ * gfortran.dg/bound_4.f90: Update test.
+
2009-05-24 Richard Guenther <rguenther@suse.de>
PR middle-end/40233
diff --git a/gcc/testsuite/gfortran.dg/bound_4.f90 b/gcc/testsuite/gfortran.dg/bound_4.f90
index dd93451..b63ce9e 100644
--- a/gcc/testsuite/gfortran.dg/bound_4.f90
+++ b/gcc/testsuite/gfortran.dg/bound_4.f90
@@ -12,14 +12,14 @@ end program test
subroutine ha0020(mf3)
implicit none
- integer xca(1), xda(1), mf3
+ integer xca(2), xda(2), mf3
xca = 1
xda = -1
- xca(1:1) = xda(1:2:mf3)
+ xca(1:2:-1) = xda(1:2:mf3)
- if (any (xca /= -1)) call abort
+ if (any (xca /= 1)) call abort
if (any(xda(1:2:mf3) /= xda(1:0))) call abort
if (size(xda(1:2:mf3)) /= 0) call abort
if (any(shape(xda(1:2:mf3)) /= 0)) call abort
diff --git a/gcc/testsuite/gfortran.dg/bounds_check_14.f90 b/gcc/testsuite/gfortran.dg/bounds_check_14.f90
index 0b7edfe..1e5a4ae 100644
--- a/gcc/testsuite/gfortran.dg/bounds_check_14.f90
+++ b/gcc/testsuite/gfortran.dg/bounds_check_14.f90
@@ -13,14 +13,14 @@ end program test
subroutine ha0020(mf3)
implicit none
- integer xca(1), xda(1), mf3
+ integer xca(2), xda(2), mf3
xca = 1
xda = -1
- xca(1:1) = xda(1:2:mf3)
+ xca(1:2:-1) = xda(1:2:mf3)
- if (any (xca /= -1)) call abort
+ if (any (xca /= 1)) call abort
if (any(xda(1:2:mf3) /= xda(1:0))) call abort
if (size(xda(1:2:mf3)) /= 0) call abort
if (any(shape(xda(1:2:mf3)) /= 0)) call abort
diff --git a/gcc/testsuite/gfortran.dg/bounds_check_fail_3.f90 b/gcc/testsuite/gfortran.dg/bounds_check_fail_3.f90
new file mode 100644
index 0000000..0826b7d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/bounds_check_fail_3.f90
@@ -0,0 +1,12 @@
+! { dg-do run }
+! { dg-options "-fbounds-check" }
+! { dg-shouldfail "foo" }
+ integer x(10), m, n
+ x = (/ (i, i = 1, 10) /)
+ m = -3
+ n = -2
+ x(7:1:m) = x(6:2:n)
+ if (any(x /= (/ 2, 2, 3, 4, 5, 6, 6, 8, 9, 10 /))) call abort()
+ x(8:1:m) = x(5:2:n)
+ end
+! { dg-output "line 10 .* bound mismatch, .* dimension 1 .* array \'x\' \\\(3/2\\\)" }
diff --git a/gcc/testsuite/gfortran.dg/bounds_check_fail_4.f90 b/gcc/testsuite/gfortran.dg/bounds_check_fail_4.f90
new file mode 100644
index 0000000..dee3ca8
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/bounds_check_fail_4.f90
@@ -0,0 +1,12 @@
+! { dg-do run }
+! { dg-options "-fbounds-check" }
+! { dg-shouldfail "foo" }
+ integer x(10), m, n
+ x = (/ (i, i = 1, 10) /)
+ m = -3
+ n = -2
+ x(7:1:m) = x(1:3) + x(6:2:n)
+ if (any(x /= (/ 5, 2, 3, 6, 5, 6, 7, 8, 9, 10 /))) call abort()
+ x(8:1:m) = x(1:3) + x(5:2:n)
+ end
+! { dg-output "line 10 .* bound mismatch, .* dimension 1 .* array \'x\' \\\(2/3\\\)" }