This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/56872] [4.8/4.9 Regression] Incorrect SUM evaluation, involving implied-do loop, with -ffrontend-optimize
- From: "mikael at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 10 Apr 2013 16:09:38 +0000
- Subject: [Bug fortran/56872] [4.8/4.9 Regression] Incorrect SUM evaluation, involving implied-do loop, with -ffrontend-optimize
- Auto-submitted: auto-generated
- References: <bug-56872-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56872
Mikael Morin <mikael at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
CC| |mikael at gcc dot gnu.org
Resolution|FIXED |
--- Comment #10 from Mikael Morin <mikael at gcc dot gnu.org> 2013-04-10 16:09:38 UTC ---
> - 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;
>
I don't think it is enough if there is something after the iterator.
Testcase:
real :: s
integer :: m
integer :: k
m = 2
s = 1000.
print *,[(s**(REAL(k-1)/REAL(m-1)),k=1,m)]
print *,SUM([(s**(REAL(k-1)/REAL(m-1)),k=1,m), 0.0])
end program sum_bug