This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/56872] [4.8/4.9 Regression] Incorrect SUM evaluation, involving implied-do loop, with -ffrontend-optimize


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]