Commit 7ac61957 by Jerry DeLisle

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
parent ea74392e
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> 2009-05-22 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/40195 PR fortran/40195
......
...@@ -3256,6 +3256,8 @@ gfc_conv_ss_startstride (gfc_loopinfo * loop) ...@@ -3256,6 +3256,8 @@ gfc_conv_ss_startstride (gfc_loopinfo * loop)
info->start[n]); info->start[n]);
tmp = fold_build2 (FLOOR_DIV_EXPR, gfc_array_index_type, tmp, tmp = fold_build2 (FLOOR_DIV_EXPR, gfc_array_index_type, tmp,
info->stride[n]); 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, tmp = fold_build2 (MAX_EXPR, gfc_array_index_type, tmp,
build_int_cst (gfc_array_index_type, 0)); build_int_cst (gfc_array_index_type, 0));
/* We remember the size of the first section, and check all the /* We remember the size of the first section, and check all the
......
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> 2009-05-24 Richard Guenther <rguenther@suse.de>
PR middle-end/40233 PR middle-end/40233
......
...@@ -12,14 +12,14 @@ end program test ...@@ -12,14 +12,14 @@ end program test
subroutine ha0020(mf3) subroutine ha0020(mf3)
implicit none implicit none
integer xca(1), xda(1), mf3 integer xca(2), xda(2), mf3
xca = 1 xca = 1
xda = -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 (any(xda(1:2:mf3) /= xda(1:0))) call abort
if (size(xda(1:2:mf3)) /= 0) call abort if (size(xda(1:2:mf3)) /= 0) call abort
if (any(shape(xda(1:2:mf3)) /= 0)) call abort if (any(shape(xda(1:2:mf3)) /= 0)) call abort
......
...@@ -13,14 +13,14 @@ end program test ...@@ -13,14 +13,14 @@ end program test
subroutine ha0020(mf3) subroutine ha0020(mf3)
implicit none implicit none
integer xca(1), xda(1), mf3 integer xca(2), xda(2), mf3
xca = 1 xca = 1
xda = -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 (any(xda(1:2:mf3) /= xda(1:0))) call abort
if (size(xda(1:2:mf3)) /= 0) call abort if (size(xda(1:2:mf3)) /= 0) call abort
if (any(shape(xda(1:2:mf3)) /= 0)) call abort if (any(shape(xda(1:2:mf3)) /= 0)) call abort
......
! { 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\\\)" }
! { 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\\\)" }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment