public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "bugs at stellardeath dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/57396] New: Wrong code with -fpredictive-commoning in Fortran double-loop Date: Fri, 24 May 2013 10:16:00 -0000 [thread overview] Message-ID: <bug-57396-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57396 Bug ID: 57396 Summary: Wrong code with -fpredictive-commoning in Fortran double-loop Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: bugs at stellardeath dot org Created attachment 30182 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30182&action=edit Small test case The following example program produces incorrect output when compiled with -O3, but remains correct with -O3 -fno-predictive-commining: > cat test.f90 module testmod implicit none contains subroutine foo(n) integer, intent(in) :: n real :: r(0:n,-n:n), a(0:n,-n:n), dj integer :: k, j ! initialize with some dummy values do j = -n, n a(:, j) = j r(:,j) = j + 1 end do ! here be dragons do k = 0, n dj = r(k, k - 2) * a(k, k - 2) r(k,k) = a(k, k - 1) * dj enddo print *, r(0,0) end subroutine end module program test use testmod implicit none call foo(5) end program > gfortran -O3 test.f90 > ./a.out -3.00000000 > > gfortran -O3 -fno-predictive-commoning test.f90 > ./a.out -2.00000000 > This only happens with gfortran 4.8, with 4.7.2 it produces the correct output (-2.0). My specific version is: > gfortran --version GNU Fortran (GCC) 4.9.0 20130517 (experimental) Copyright (C) 2013 Free Software Foundation, Inc. GNU Fortran comes with NO WARRANTY, to the extent permitted by law. You may redistribute copies of GNU Fortran under the terms of the GNU General Public License. For more information about these matters, see the file named COPYING
next reply other threads:[~2013-05-24 10:16 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-05-24 10:16 bugs at stellardeath dot org [this message] 2013-05-24 10:17 ` [Bug tree-optimization/57396] " bugs at stellardeath dot org 2013-05-24 11:21 ` [Bug tree-optimization/57396] [4.7/4.8/4.9 Regression] " rguenth at gcc dot gnu.org 2013-05-24 11:52 ` rguenth at gcc dot gnu.org 2013-05-24 11:55 ` dominiq at lps dot ens.fr 2013-05-24 12:01 ` [Bug tree-optimization/57396] [4.8/4.9 " rguenth at gcc dot gnu.org 2013-05-27 7:56 ` [Bug tree-optimization/57396] [4.8 " rguenth at gcc dot gnu.org 2013-08-29 13:11 ` jakub at gcc dot gnu.org 2013-08-29 13:17 ` jakub at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-57396-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).