Patchwork [fortran] Committed fix for PR 56782

login
register
mail settings
Submitter Thomas Koenig
Date April 8, 2013, 7:39 p.m.
Message ID <51631CDB.9050008@netcologne.de>
Download mbox | patch
Permalink /patch/234873/
State New
Headers show

Comments

Thomas Koenig - April 8, 2013, 7:39 p.m.
Hello world,

I committed the attached patch as obvious to fix the regression
with array constructors on trunk, after regression-testing.

Will commit to 4.8 next.

	Thomas

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.

Patch

Index: frontend-passes.c
===================================================================
--- frontend-passes.c	(Revision 197233)
+++ frontend-passes.c	(Arbeitskopie)
@@ -300,7 +300,12 @@  callback_reduction (gfc_expr **e, int *walk_subtre
 
   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);