[Bug tree-optimization/83569] New: Wrong constant folding
dmalcolm at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jan 3 16:56:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83569
Bug ID: 83569
Summary: Wrong constant folding
Product: gcc
Version: 8.0
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
Target Milestone: ---
GCC 8.0 for x86_64 miscompiles the following code.
% cat test.c
int a[2] = {0,1};
int x = 129;
int main (void)
{
volatile int v = 0;
int t = x;
for (int i = 0; i < (1+v+v+v+v+v+v+v+v+a[a[0]]); i++) {
t = a[(signed char)(130-x)];
}
if (t != 1) __builtin_abort();
return 0;
}
% gcc-8.0.0 test.c
% ./a.out
% gcc-8.0.0 test.c -O3
% ./a.out
zsh: abort (core dumped) ./a.out
% gcc-8.0.0 -v
Using built-in specs.
COLLECT_GCC=gcc-8.0.0
COLLECT_LTO_WRAPPER=/home/cappie/opt/gcc-8.0.0/libexec/gcc/x86_64-pc-linux-gnu/8.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/home/cappie/opt/gcc-8.0.0 --disable-nls
--disable-multilib --program-suffix=-8.0.0 --enable-languages=c
Thread model: posix
gcc version 8.0.0 20171215 (experimental) (GCC)
--- Comment #1 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
*** Bug 83579 has been marked as a duplicate of this bug. ***
More information about the Gcc-bugs
mailing list