]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* trans-array.c (gfc_conv_loop_setup): Test whether the loop
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 5 Jan 2007 21:22:05 +0000 (21:22 +0000)
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 5 Jan 2007 21:22:05 +0000 (21:22 +0000)
stride is one, to avoid fold_build2 introducing a useless
NON_LVALUE_EXPR node.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120500 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/trans-array.c

index c574dc42f23d0ea021ea4ed4747f18a3b614329e..73dcf0e57f2c1a8b6adbef3a4d03de07864b3419 100644 (file)
@@ -1,3 +1,9 @@
+2007-01-05  Roger Sayle  <roger@eyesopen.com>
+
+       * 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.
+
 2007-01-05  Tobias Burnus  <burnus@net-b.de>
 
        * symbol.c (check_conflict): Fix error message.
index 10243fe5712fe8c778e4431be7a4d95635f5ab6d..d6d3ff7eff086f7a2d19063deff1e24ddc4e2252 100644 (file)
@@ -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,