diff options
author | Francois-Xavier Coudert <coudert@clipper.ens.fr> | 2006-05-26 23:18:45 +0200 |
---|---|---|
committer | François-Xavier Coudert <fxcoudert@gcc.gnu.org> | 2006-05-26 21:18:45 +0000 |
commit | e8300d6eaf5937e3cd56b41f620f4380a21dab97 (patch) | |
tree | fd35e65870ed4ec00d662052926c0f3383969046 | |
parent | 7c7ce73aa7b6fece609d085e7ad265abf34e08f1 (diff) | |
download | gcc-e8300d6eaf5937e3cd56b41f620f4380a21dab97.zip gcc-e8300d6eaf5937e3cd56b41f620f4380a21dab97.tar.gz gcc-e8300d6eaf5937e3cd56b41f620f4380a21dab97.tar.bz2 |
re PR libfortran/27524 (-fbounds-check interacts with array function)
PR fortran/27524
* trans-array.c (gfc_trans_dummy_array_bias): Don't use stride as
a temporary variable when -fbounds-check is enabled, since its
value will be needed later.
* gfortran.dg/bounds_check_1.f90: New test.
From-SVN: r114142
-rw-r--r-- | gcc/fortran/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/fortran/trans-array.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/bounds_check_1.f90 | 12 |
4 files changed, 27 insertions, 3 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index eed3e0e..e4e2db2 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2006-05-26 Francois-Xavier Coudert <coudert@clipper.ens.fr> + + PR fortran/27524 + * trans-array.c (gfc_trans_dummy_array_bias): Don't use stride as + a temporary variable when -fbounds-check is enabled, since its + value will be needed later. + 2006-05-26 Thomas Koenig <Thomas.Koenig@online.de> PR fortran/23151 diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 32283a3..34742c3 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -3564,7 +3564,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body) tree dumdesc; tree tmp; tree stmt; - tree stride; + tree stride, stride2; tree stmt_packed; tree stmt_unpacked; tree partial; @@ -3711,9 +3711,9 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body) tmp = fold_build2 (MINUS_EXPR, gfc_array_index_type, ubound, lbound); - stride = build2 (MINUS_EXPR, gfc_array_index_type, + stride2 = build2 (MINUS_EXPR, gfc_array_index_type, dubound, dlbound); - tmp = fold_build2 (NE_EXPR, gfc_array_index_type, tmp, stride); + tmp = fold_build2 (NE_EXPR, gfc_array_index_type, tmp, stride2); gfc_trans_runtime_check (tmp, gfc_strconst_bounds, &block); } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e45fa3b..4910f76 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2006-05-26 Francois-Xavier Coudert <coudert@clipper.ens.fr> + + PR fortran/27524 + * gfortran.dg/bounds_check_1.f90: New test. + 2006-05-26 Ulrich Weigand <uweigand@de.ibm.com> PR rtl-optimization/27661 diff --git a/gcc/testsuite/gfortran.dg/bounds_check_1.f90 b/gcc/testsuite/gfortran.dg/bounds_check_1.f90 new file mode 100644 index 0000000..c05f445 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/bounds_check_1.f90 @@ -0,0 +1,12 @@ +! { dg-do run } +! { dg-options "-fbounds-check" } +! PR fortran/27524 + integer :: res(1) + res = F() + if (res(1) /= 1) call abort + contains + function F() + integer :: F(1) + f = 1 + end function F + end |