public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "dominiq at lps dot ens.fr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/49103] [4.6/4.7 Regression] local variables exchange values / wrong code with -O3
Date: Sat, 21 May 2011 23:29:00 -0000	[thread overview]
Message-ID: <bug-49103-4-SrACfqMEEs@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-49103-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49103

--- Comment #4 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2011-05-21 23:11:01 UTC ---
Reverting revision 169083 on trunk fixes this pr (see
http://gcc.gnu.org/ml/gcc-patches/2011-01/msg01442.html for its motivation).
Further reduced test:

!----------------------------------
module dg_grid

implicit none

integer :: par_world_dims = 3

type world_t
   integer :: dims
   real(kind=8), dimension(:), pointer :: lengths
end type

contains

subroutine grid_new(grid)
   type(world_t), intent(inout) :: grid

   grid%dims = par_world_dims
   call grid_faces(grid)

end subroutine

! Start looking here: This is the routine that gives trouble.
subroutine grid_faces(grid)
   type(world_t), intent(inout) :: grid

   integer :: dimi, bordi
   integer, dimension(par_world_dims-1) :: fgrades
   integer, dimension(par_world_dims-1) :: fbasegrades

   do dimi=1,grid%dims-2

      ! The bug makes those two arrays exchange values temporarily.
      fbasegrades = (/ 1, 1 /)
      fgrades = (/ 2, 2 /)
      do bordi=1,2
         write(*,*) 'Here is the bug. The grades should be (2 2):', fgrades
         write(*,*) 'Compare the base grades:', fbasegrades
      end do
      write(*,*) 'grades again', fgrades

   end do
end subroutine

end module

program test_gcc46gridbug

use dg_grid

implicit none

type(world_t) :: grid

call grid_new(grid)

end program
!----------------------------------


  parent reply	other threads:[~2011-05-21 23:23 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-21 17:54 [Bug fortran/49103] New: " thomas.orgis at awi dot de
2011-05-21 18:50 ` [Bug fortran/49103] " dominiq at lps dot ens.fr
2011-05-21 21:37 ` [Bug fortran/49103] [4.6/4.7 Regression] " dominiq at lps dot ens.fr
2011-05-21 22:07 ` dominiq at lps dot ens.fr
2011-05-21 23:29 ` dominiq at lps dot ens.fr [this message]
2011-05-22 11:12 ` rguenth at gcc dot gnu.org
2011-05-22 11:22 ` dominiq at lps dot ens.fr
2011-05-23  7:59 ` jakub at gcc dot gnu.org
2011-05-28 11:28 ` dominiq at lps dot ens.fr
2011-05-28 11:29 ` burnus at gcc dot gnu.org
2011-05-28 18:05 ` dominiq at lps dot ens.fr
2011-05-31 11:59 ` jakub at gcc dot gnu.org
2011-05-31 13:40 ` jakub at gcc dot gnu.org
2011-06-12 13:44 ` rguenth at gcc dot gnu.org
2011-06-13  8:43 ` burnus at gcc dot gnu.org
2011-06-14 15:27 ` jakub at gcc dot gnu.org
2011-06-14 15:29 ` jakub at gcc dot gnu.org
2011-06-14 22: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-49103-4-SrACfqMEEs@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: link
Be 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).