This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/57656] New: Wrong constant folding
- From: "ishiura-compiler at ml dot kwansei.ac.jp" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 19 Jun 2013 22:10:01 +0000
- Subject: [Bug tree-optimization/57656] New: Wrong constant folding
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57656
Bug ID: 57656
Summary: Wrong constant folding
Product: gcc
Version: 4.8.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: ishiura-compiler at ml dot kwansei.ac.jp
GCC 4.8.2 for i686 miscompiles the following code.
$ cat error.c
int main (void)
{
int a = -1;
int b = 2147483647;
int c = 2;
int t = 1 - ((a - b) / c); // t = 1 - ( -2147483648 / 2 )
if (t != 1073741825) { __builtin_abort(); }
return 0;
}
$ i686-pc-linux-gnu-gcc-4.8.2 error.c -O2
$ ./a.out
Aborted (core dumped)
There was no problem with an x86_64 target.
$ i686-pc-linux-gnu-gcc-4.8.2 -v
Using built-in specs.
COLLECT_GCC=i686-pc-linux-gnu-gcc-4.8.2
COLLECT_LTO_WRAPPER=/usr/local/i686-tools/gcc-4.8.2/libexec/gcc/i686-pc-linux-gnu/4.8.2/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: /home/hassy/gcc/configure
--prefix=/usr/local/i686-tools/gcc-4.8.2/
--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.2 20130607 (prerelease) (GCC)