public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/32533]  New: [4.2] miscompilation at -O3 -ffast-math -ftree-vectorize -march=native
@ 2007-06-28  6:07 jv244 at cam dot ac dot uk
  2007-06-28  8:13 ` [Bug tree-optimization/32533] [4.2 regression] " ubizjak at gmail dot com
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: jv244 at cam dot ac dot uk @ 2007-06-28  6:07 UTC (permalink / raw)
  To: gcc-bugs

derived from CP2K and discussed in PR 29975, the following is miscompiled with
the current 4.2 branch :

vondele@pcihopt3:/scratch/vondele/clean/cp2k/src> cat test.f90
      SUBROUTINE T(nsubcell,sab_max,subcells)
       INTEGER, PARAMETER :: dp=KIND(0.0D0)
       REAL(dp) :: sab_max(3), subcells,nsubcell(3)

        nsubcell(:) = MIN(MAX(1,NINT(0.5_dp*subcells/sab_max(:))),20)
        write(6,*) nsubcell
      END SUBROUTINE

       INTEGER, PARAMETER :: dp=KIND(0.0D0)
       REAL(dp) :: sab_max(3), subcells,nsubcell(3)
       subcells=2.00000000000000
       sab_max=0.590060749244805_dp
       write(6,*) NINT(0.5_dp*subcells/sab_max(1))
       CALL T(nsubcell,sab_max,subcells)
     END


vondele@pcihopt3:/scratch/vondele/clean/cp2k/src> gfortran -v -O3 -ffast-math
-ftree-vectorize -march=native test.f90
Driving: gfortran -v -O3 -ffast-math -ftree-vectorize -march=native test.f90
-lgfortranbegin -lgfortran -lm -shared-libgcc
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: /data03/vondele/gcc_4_2_branch/gcc/configure
--prefix=/data03/vondele/gcc_4_2_branch/build --with-gmp=/data03/vondele/
--with-mpfr=/data03/vondele/ --enable-languages=c,fortran
Thread model: posix
gcc version 4.2.1 20070627 (prerelease)

/data03/vondele/gcc_4_2_branch/build/libexec/gcc/x86_64-unknown-linux-gnu/4.2.1/f951
test.f90 -march=k8 -mtune=k8 -quiet -dumpbase test.f90 -auxbase test -O3
-version -ffast-math -ftree-vectorize -I
/data03/vondele/gcc_4_2_branch/build/lib/gcc/x86_64-unknown-linux-gnu/4.2.1/finclude
-o /tmp/ccTYHMGd.s
GNU F95 version 4.2.1 20070627 (prerelease) (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.2.1 20070627 (prerelease).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
 as -V -Qy -o /tmp/ccs8OyYj.o /tmp/ccTYHMGd.s
GNU assembler version 2.16.91.0.5 (x86_64-suse-linux) using BFD version
2.16.91.0.5 20051219 (SUSE Linux)

/data03/vondele/gcc_4_2_branch/build/libexec/gcc/x86_64-unknown-linux-gnu/4.2.1/collect2
--eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2
/usr/lib/../lib64/crt1.o /usr/lib/../lib64/crti.o
/data03/vondele/gcc_4_2_branch/build/lib/gcc/x86_64-unknown-linux-gnu/4.2.1/crtbegin.o
-L/data03/vondele/gcc_4_2_branch/build/lib/gcc/x86_64-unknown-linux-gnu/4.2.1
-L/data03/vondele/gcc_4_2_branch/build/lib/gcc/x86_64-unknown-linux-gnu/4.2.1/../../../../lib64
-L/lib/../lib64 -L/usr/lib/../lib64
-L/data03/vondele/gcc_4_2_branch/build/lib/gcc/x86_64-unknown-linux-gnu/4.2.1/../../..
/tmp/ccs8OyYj.o -lgfortranbegin -lgfortran -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc
/data03/vondele/gcc_4_2_branch/build/lib/gcc/x86_64-unknown-linux-gnu/4.2.1/crtfastmath.o
/data03/vondele/gcc_4_2_branch/build/lib/gcc/x86_64-unknown-linux-gnu/4.2.1/crtend.o
/usr/lib/../lib64/crtn.o
vondele@pcihopt3:/scratch/vondele/clean/cp2k/src> ./a.out
           2
   20.0000000000000        20.0000000000000        20.0000000000000
vondele@pcihopt3:/scratch/vondele/clean/cp2k/src> gfortran -O0 test.f90
vondele@pcihopt3:/scratch/vondele/clean/cp2k/src> ./a.out
           2
   2.00000000000000        2.00000000000000        2.00000000000000

the result is incorrectly 20.0 instead of 2.0 with optimization


-- 
           Summary: [4.2] miscompilation at -O3 -ffast-math -ftree-vectorize
                    -march=native
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jv244 at cam dot ac dot uk


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


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2007-07-04  5:56 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-28  6:07 [Bug middle-end/32533] New: [4.2] miscompilation at -O3 -ffast-math -ftree-vectorize -march=native jv244 at cam dot ac dot uk
2007-06-28  8:13 ` [Bug tree-optimization/32533] [4.2 regression] " ubizjak at gmail dot com
2007-06-28  8:14 ` ubizjak at gmail dot com
2007-06-28  8:36 ` rguenth at gcc dot gnu dot org
2007-06-29  7:13 ` jv244 at cam dot ac dot uk
2007-06-29  7:51 ` [Bug tree-optimization/32533] [4.1/4.2 " jv244 at cam dot ac dot uk
2007-06-29  8:06 ` jv244 at cam dot ac dot uk
2007-06-30 15:40 ` ubizjak at gmail dot com
2007-07-01  8:51 ` dorit at gcc dot gnu dot org
2007-07-01  9:40 ` ubizjak at gmail dot com
2007-07-02  9:41 ` ubizjak at gmail dot com
2007-07-02 10:21 ` jv244 at cam dot ac dot uk
2007-07-02 14:26 ` uros at gcc dot gnu dot org
2007-07-04  3:31 ` mmitchel at gcc dot gnu dot org
2007-07-04  5:41 ` uros at gcc dot gnu dot org
2007-07-04  5:49 ` uros at gcc dot gnu dot org
2007-07-04  5:56 ` ubizjak at gmail dot com

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).