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.
(In reply to comment #0) > > 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 What is ftn? On my system, when I build MPICH2 I get mpf90. I added an else clause for printing the right values node10:kargl[227] ../mpich2/bin/mpif90 -o z -O2 long.f90 node10:kargl[228] ./z Got right value for WIN_DISP_UNIT ( 4 , should be 4 ) node10:kargl[229] ../mpich2/bin/mpiexec -machinefile mf1 -n 1 ./z Got right value for WIN_DISP_UNIT ( 4 , should be 4 ) node10:kargl[231] ../mpich2/bin/mpif90 --version GNU Fortran (GCC) 4.2.1 20070523 (prerelease)
Subject: Re: GFORTRAN OPTIMIZATION ERROR ABOVE -O0 FOR MPICH2 TEST F90_RMA/BASEATTRWINF90.F90 kargl at gcc dot gnu dot org wrote: > ------- Comment #1 from kargl at gcc dot gnu dot org 2007-09-07 21:03 ------- > (In reply to comment #0) > > >>> 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 >> > > What is ftn? On my system, when I build MPICH2 I get mpf90. > ftn is a script that allows the user to see a common interface for all the compilers we document. Which compiler is used is controlled by the module facility. Library sets are selected based on the compiler and OS combinations. The same command is used for both serial and parallel programs. Cheers, Bill > I added an else clause for printing the right values > > node10:kargl[227] ../mpich2/bin/mpif90 -o z -O2 long.f90 > node10:kargl[228] ./z > Got right value for WIN_DISP_UNIT ( 4 , should be 4 ) > node10:kargl[229] ../mpich2/bin/mpiexec -machinefile mf1 -n 1 ./z > Got right value for WIN_DISP_UNIT ( 4 , should be 4 ) > > node10:kargl[231] ../mpich2/bin/mpif90 --version > GNU Fortran (GCC) 4.2.1 20070523 (prerelease) > > >
Subject: Re: GFORTRAN OPTIMIZATION ERROR ABOVE -O0 FOR MPICH2 TEST F90_RMA/BASEATTRWINF90.F90 > > >>> 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 > >> > > > > What is ftn? On my system, when I build MPICH2 I get mpf90. > > > > ftn is a script that allows the user to see a common interface for all > the compilers we document. Which compiler is used is controlled by the > module facility. Library sets are selected based on the compiler and OS > combinations. The same command is used for both serial and parallel > programs. > Any chance that you can skip the script and use mpif90 directly? Also, I have MPICH2 1.05p4. Can you this version? Is the version of MPICH2 that you used patched by Cray?
Subject: Re: GFORTRAN OPTIMIZATION ERROR ABOVE -O0 FOR MPICH2 TEST F90_RMA/BASEATTRWINF90.F90 sgk at troutmask dot apl dot washington dot edu wrote: > ------- Comment #3 from sgk at troutmask dot apl dot washington dot edu 2007-09-08 19:17 ------- > Subject: Re: GFORTRAN OPTIMIZATION ERROR ABOVE -O0 FOR MPICH2 TEST > F90_RMA/BASEATTRWINF90.F90 > > >>>>> 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 >>>> >>>> >>> What is ftn? On my system, when I build MPICH2 I get mpf90. >>> >>> >> ftn is a script that allows the user to see a common interface for all >> the compilers we document. Which compiler is used is controlled by the >> module facility. Library sets are selected based on the compiler and OS >> combinations. The same command is used for both serial and parallel >> programs. >> >> > > Any chance that you can skip the script and use mpif90 directly? > Also, I have MPICH2 1.05p4. Can you this version? Is the > version of MPICH2 that you used patched by Cray? > > I believe we use "plain" mpich2 for the Opteron systems. Here is the detail on the ftn command: nid00007/longb> ftn -v /opt/xt-pe/2.1/bin/snos64/ftn: INFO: linux target is being used mpif90 for 1.0.2 Driving: /opt/gcc/4.2.1/bin/../snos/bin/gfortran -static -v -I/opt/xt-mpt/2.1/mpich2-64/GP/include -I/opt/xt-mpt/2.1/mpich2-64/GP/include -L/opt/xt-mpt/2.1/mpich2-64/GP/lib -I/opt/xt-libsci/10.1.0/gnu/snos64/include -I/opt/xt-libsci/10.1.0/gnu/snos64/incl Using built-in specs. Target: x86_64-suse-linux Configured with: ../xt-gcc-4.2.1/configure --prefix=/opt/gcc/4.2.1/snos --disable-nls --libdir=/opt/gcc/4.2.1/snos/lib --enable-languages=c,c++,fortran --with-gxx-include-dir=/opt/gcc/4.2.1/snos/include/g++ --with-slibdir=/opt/gcc/4.2.1/snos/lib --with-sy Thread model: posix gcc version 4.2.1 20070719 (rpm:3) /opt/gcc/4.2.1/snos/libexec/gcc/x86_64-suse-linux/4.2.1/collect2 -m elf_x86_64 -static /usr/lib/../lib64/crt1.o /usr/lib/../lib64/crti.o /opt/gcc/4.2.1/snos/lib/gcc/x86_64-suse-linux/4.2.1/crtbeginT.o -L/opt/xt-mpt/2.1/mpich2-64/GP/lib -L/opt/xt-libsci/1 /opt/gcc/4.2.1/snos/lib/gcc/x86_64-suse-linux/4.2.1/libgfortranbegin.a(fmain.o)(.text+0xa): In function `main': ../../../xt-gcc-4.2.1/libgfortran/fmain.c:18: undefined reference to `MAIN__' collect2: ld returned 1 exit status Note: The version of gcc we are using is not the same as the one you noted, and for the XT systems all linking is static. Our version of mpich2 appears to be older. I can ask the MPI group for a newer version. Cheers, Bill
Subject: Re: GFORTRAN OPTIMIZATION ERROR ABOVE -O0 FOR MPICH2 TEST F90_RMA/BASEATTRWINF90.F90 On Mon, Sep 10, 2007 at 04:03:21PM -0000, longb at cray dot com wrote: > > gcc version 4.2.1 20070719 (rpm:3) > > Note: The version of gcc we are using is not the same as the one you > noted, and for the XT systems all linking is static. I checked my version again, and it was 4.2.1 20070523. There aren't many significant changes between this version and yours to at least the Fortran front-end. I just rebuild 4.2.2 (note it's been marked for a release) and get GNU F95 version 4.2.2 20070905 (prerelease) (x86_64-portbld-freebsd7.0) Your program with my addition and static linking gives node10:kargl[254] ../mpich2/bin/mpiexec -machinefile mf1 -n 1 ./long Got right value for WIN_DISP_UNIT ( 4 , should be 4 ) node10:kargl[255] ./long Got right value for WIN_DISP_UNIT ( 4 , should be 4 ) > Our version of mpich2 appears to be older. I can ask the MPI group for > a newer version. The mpich2 changelog suggests that there may be some changes which effect gfortran+mpich2.
Subject: Re: GFORTRAN OPTIMIZATION ERROR ABOVE -O0 FOR MPICH2 TEST F90_RMA/BASEATTRWINF90.F90 sgk at troutmask dot apl dot washington dot edu wrote: > ------- Comment #5 from sgk at troutmask dot apl dot washington dot edu 2007-09-10 18:28 ------- > Subject: Re: GFORTRAN OPTIMIZATION ERROR ABOVE -O0 FOR MPICH2 TEST > F90_RMA/BASEATTRWINF90.F90 > > On Mon, Sep 10, 2007 at 04:03:21PM -0000, longb at cray dot com wrote: > >> gcc version 4.2.1 20070719 (rpm:3) >> >> Note: The version of gcc we are using is not the same as the one you >> noted, and for the XT systems all linking is static. >> > > I checked my version again, and it was 4.2.1 20070523. There > aren't many significant changes between this version and yours > to at least the Fortran front-end. I just rebuild 4.2.2 (note > it's been marked for a release) and get > > GNU F95 version 4.2.2 20070905 (prerelease) (x86_64-portbld-freebsd7.0) > > Your program with my addition and static linking gives > > node10:kargl[254] ../mpich2/bin/mpiexec -machinefile mf1 -n 1 ./long > Got right value for WIN_DISP_UNIT ( 4 , should be 4 ) > node10:kargl[255] ./long > Got right value for WIN_DISP_UNIT ( 4 , should be 4 ) > > >> Our version of mpich2 appears to be older. I can ask the MPI group for >> a newer version. >> > > The mpich2 changelog suggests that there may be some changes which > effect gfortran+mpich2. > I had our MPI guy run the test with a virgin mpich2 build and he also finds no error. This appears to be a bug in the version of the mpich2 library we have on our system. I've reassigned the bug to them. Please close the bug against gfortran. Cheers, Bil > >
Closing the bug at Bill's request. The bug appears to be local to his setup. Thanks Bill for the bug report; if you have future problems don't hesitate in sending a bug report.