This test
case responds with correct answers for optimization level -O0 but fails at
higher optimization levels.  The test case was derived from MPICH2 test
f90_rma/baseattrwinf90.f90 or the corresponding f77_rma/baseattrwinf.f .

> cat bug2867.f90
! Derived from MPICH2 test f90_rma/baseattrwinf90.f90
!     mpich2-1.0.4p1 test source
      program main
      use mpi
      implicit none
      integer (kind=MPI_ADDRESS_KIND) valout, n
      logical flag
      integer base(1024), disp, win, commsize, ierr

      call MPI_init( ierr )
      call mpi_comm_size( MPI_COMM_WORLD, commsize, ierr )
      n    = 1024
      disp = 4
      call MPI_Win_create( base, n, disp, MPI_INFO_NULL, MPI_COMM_WORLD,  &
      &  win, ierr )
      call MPI_Win_get_attr( win, MPI_WIN_SIZE, valout, flag, ierr )
      if (valout .ne. n) then
            print *, "Got incorrect value for WIN_SIZE (", valout,  &
                     ", should be ", n, ")"
      endif
      call MPI_Win_get_attr( win, MPI_WIN_DISP_UNIT, valout, flag, ierr)
      if (valout .ne. disp) then
            print *, "Got wrong value for WIN_DISP_UNIT (", valout,  &
                     ", should be ", disp, ")"
      endif
      call MPI_Win_free( win, ierr )
      call MPI_Finalize( ierr )
      end

> ftn -o x -O2 bug2867.f90
> aprun -n 1 ./x
 Got incorrect value for WIN_SIZE (      140733193389056 , should be

1024 )
 Got wrong value for WIN_DISP_UNIT (      140733193388036 , should be

4 )
Application 22344 resources: utime 0, stime 0

Expected output:

> ftn -o x -O0 bug2867.f90
> aprun -n 1 ./x
Application 22346 resources: utime 0, stime 0


> ftn -v
. . .
gcc version 4.2.1 20070719 (rpm:3)
. . .

Note that the "wrong" answers in hex are 00007FFF00000400 and 00007FFF00000004
respectively.  If the upper 32 bits were zero, they would be correct. This
appears to be a type mismatch or casting problem.


-- 
           Summary: GFORTRAN OPTIMIZATION ERROR ABOVE -O0 FOR MPICH2 TEST
                    F90_RMA/BASEATTRWINF90.F90
           Product: gcc
           Version: 4.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: longb at cray dot com
 GCC build triplet: x86_64-suse-linux
  GCC host triplet: x86_64-suse-linux
GCC target triplet: x86_64-suse-linux


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

Reply via email to