Commit a2d0800a by Thomas Koenig

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
parent 0c3f68a0
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-07 Tobias Burnus <burnus@net-b.de>
PR fortran/56849
......
......@@ -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);
......
2013-04-08 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/56782
* gfortran.dg/array_constructor_44.f90: New test.
2013-04-08 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/56871
......
! { dg-do run }
! { dg-options "-ffrontend-optimize" }
! PR 56872 - wrong front-end optimization with a single constructor.
! Original bug report by Rich Townsend.
integer :: k
real :: s
integer :: m
s = 2.0
m = 4
res = SUM([(s**(REAL(k-1)/REAL(m-1)),k=1,m)])
if (abs(res - 5.84732246) > 1e-6) call abort
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment