[Bug fortran/49103] [4.6/4.7 Regression] local variables exchange values / wrong code with -O3
dominiq at lps dot ens.fr
gcc-bugzilla@gcc.gnu.org
Sat May 21 23:29:00 GMT 2011
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
!----------------------------------
More information about the Gcc-bugs
mailing list