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



             Bug #: 57083

           Summary: Wrong constant folding

    Classification: Unclassified

           Product: gcc

           Version: 4.8.1

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: tree-optimization

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: ishiura-compi...@ml.kwansei.ac.jp





GCC 4.8.1 prerelease (x86_64 for both linux and darwin12) miscompiles

the following code with optimize option "-O1 -ftree-vrp."





  $ cat error.c



  /* UINT_MAX == 4294967295 */

  short x = 1;

  int y = 0;



  int main (void)

  {

    unsigned t = ( 2147450881U - (unsigned) x ) << ( y == 0 );

    if ( t != 4294901760U ) { __builtin_abort(); }

    return 0;

  }



  $ x86_64-unknown-linux-gnu-gcc-4.8.1 error.c -O1 -ftree-vrp

  $ ./a.out

  Aborted (core dumped)





There was no problem with GCC 4.7.3.  



-----



$ x86_64-unknown-linux-gnu-gcc-4.8.1 -v

Target: x86_64-unknown-linux-gnu

Configured with: /home/hassy/gcc/configure

--prefix=/usr/local/x86_64-tools/gcc-4.8.0/

--with-gmp=/usr/local/gmp-5.1.1/ --with-mpfr=/usr/local/mpfr-3.1.2/

--with-mpc=/usr/local/mpc-1.0.1/ --disable-multilib --disable-nls

--enable-languages=c

Thread model: posix

gcc version 4.8.1 20130422 (prerelease) (GCC)



$ gcc-mp-4.8 -v

Using built-in specs.

COLLECT_GCC=gcc-mp-4.8

COLLECT_LTO_WRAPPER=/opt/local/libexec/gcc/x86_64-apple-darwin12/4.8.1/lto-wrapper

Target: x86_64-apple-darwin12

Configured with: ../gcc-4.8-20130411/configure --prefix=/opt/local

--build=x86_64-apple-darwin12

--enable-languages=c,c++,objc,obj-c++,lto,fortran,java

--libdir=/opt/local/lib/gcc48 --includedir=/opt/local/include/gcc48

--infodir=/opt/local/share/info --mandir=/opt/local/share/man

--datarootdir=/opt/local/share/gcc-4.8 --with-local-prefix=/opt/local

--with-system-zlib --disable-nls --program-suffix=-mp-4.8

--with-gxx-include-dir=/opt/local/include/gcc48/c++/ --with-gmp=/opt/local

--with-mpfr=/opt/local --with-mpc=/opt/local --with-ppl=/opt/local

--with-cloog=/opt/local --enable-cloog-backend=isl

--disable-cloog-version-check --enable-stage1-checking --disable-multilib

--enable-lto --enable-libstdcxx-time --with-as=/opt/local/bin/as

--with-ld=/opt/local/bin/ld --with-ar=/opt/local/bin/ar

--with-bugurl=https://trac.macports.org/newticket --with-pkgversion='MacPorts

gcc48 4.8-20130411_0'

Thread model: posix

gcc version 4.8.1 20130411 (prerelease) (MacPorts gcc48 4.8-20130411_0)

Reply via email to