summaryrefslogtreecommitdiff
path: root/gcc/fortran/frontend-passes.c
diff options
context:
space:
mode:
authorThomas Koenig <tkoenig@gcc.gnu.org>2013-04-08 19:36:43 +0000
committerThomas Koenig <tkoenig@gcc.gnu.org>2013-04-08 19:36:43 +0000
commita2d0800a410ddd6dd321fd6b92c0e21f029fcbab (patch)
tree215bf2c76484ac343ef397d3ddb0d5780a8a0b55 /gcc/fortran/frontend-passes.c
parent0c3f68a025fc9d41a615854c21c6f2363739c066 (diff)
downloadgcc-a2d0800a410ddd6dd321fd6b92c0e21f029fcbab.tar.gz
re PR fortran/56872 (Incorrect SUM evaluation, involving implied-do loop, with -ffrontend-optimize)
2013-04-08 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/56782 * frontend-passes.c (callback_reduction): Dont't do any simplification if there is only a single element which has an iterator. 2013-04-08 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/56782 * gfortran.dg/array_constructor_44.f90: New test. From-SVN: r197610
Diffstat (limited to 'gcc/fortran/frontend-passes.c')
-rw-r--r--gcc/fortran/frontend-passes.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c
index a77afc58e4b..b2d01169e3b 100644
--- a/gcc/fortran/frontend-passes.c
+++ b/gcc/fortran/frontend-passes.c
@@ -300,7 +300,12 @@ callback_reduction (gfc_expr **e, int *walk_subtrees ATTRIBUTE_UNUSED,
c = gfc_constructor_first (arg->value.constructor);
- if (c == NULL)
+ /* Don't do any simplififcation if we have
+ - no element in the constructor or
+ - only have a single element in the array which contains an
+ iterator. */
+
+ if (c == NULL || (c->iterator != NULL && gfc_constructor_next (c) == NULL))
return 0;
res = copy_walk_reduction_arg (c->expr, fn);