aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-array.c
diff options
context:
space:
mode:
authorRoger Sayle <roger@eyesopen.com>2007-01-05 21:22:05 +0000
committerRoger Sayle <sayle@gcc.gnu.org>2007-01-05 21:22:05 +0000
commitc96111c00d1c3c1a40535a4580681347eeb801b9 (patch)
tree20bb6a799235d34926f0f093e96c4cf0c9975937 /gcc/fortran/trans-array.c
parentafe1a916d7e6195a85569d33685fd3259f9a0e84 (diff)
downloadgcc-c96111c00d1c3c1a40535a4580681347eeb801b9.zip
gcc-c96111c00d1c3c1a40535a4580681347eeb801b9.tar.gz
gcc-c96111c00d1c3c1a40535a4580681347eeb801b9.tar.bz2
trans-array.c (gfc_conv_loop_setup): Test whether the loop stride is one...
* trans-array.c (gfc_conv_loop_setup): Test whether the loop stride is one, to avoid fold_build2 introducing a useless NON_LVALUE_EXPR node. From-SVN: r120500
Diffstat (limited to 'gcc/fortran/trans-array.c')
-rw-r--r--gcc/fortran/trans-array.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index 10243fe..d6d3ff7 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -3141,8 +3141,10 @@ gfc_conv_loop_setup (gfc_loopinfo * loop)
{
/* Calculate the offset relative to the loop variable.
First multiply by the stride. */
- tmp = fold_build2 (MULT_EXPR, gfc_array_index_type,
- loop->from[n], info->stride[n]);
+ tmp = loop->from[n];
+ if (!integer_onep (info->stride[n]))
+ tmp = fold_build2 (MULT_EXPR, gfc_array_index_type,
+ tmp, info->stride[n]);
/* Then subtract this from our starting value. */
tmp = fold_build2 (MINUS_EXPR, gfc_array_index_type,