[Bug tree-optimization/69907] New: wrong code at -O3 on x86_64-linux-gnu
helloqirun at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Feb 22 20:53:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69907
Bug ID: 69907
Summary: wrong code at -O3 on x86_64-linux-gnu
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: helloqirun at gmail dot com
Target Milestone: ---
The current gcc trunk mis-compiles PR49038.c on x86_64-linux at -O3 in both
32-bit and 64-bit modes.
Below is a slightly reduced case.
$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/home/absozero/trunk/root-gcc/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/home/absozero/trunk/root-gcc
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 6.0.0 20160222 (experimental) [trunk revision 233601] (GCC)
$ gcc-trunk -O3 abc.c
$ ./a.out
Segmentation fault (core dumped)
$ cat abc.c
void *mmap();
void foo(unsigned *p1, unsigned short *p2) {
int n;
for (n = 0; n < 320; n++)
p1[n] = p2[n * 2];
}
int main() {
void *x;
long a;
x = mmap(4432, 65536, 2, 2 | 32, 1, 0);
a = 65536 - (2 * 320 - 1) * sizeof(short);
foo(x, (unsigned short *)((char *)x + a));
}
More information about the Gcc-bugs
mailing list