[Bug tree-optimization/86749] New: Gcc miscompiles at -O3 with sse4 on valid code
helloqirun at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Jul 31 07:07:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86749
Bug ID: 86749
Summary: Gcc miscompiles at -O3 with sse4 on valid code
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: helloqirun at gmail dot com
Target Milestone: ---
It seems to be a recent regression. gcc-8.1 correctly compiles.
$ 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/9.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 9.0.0 20180730 (experimental) [trunk revision 263066] (GCC)
$ gcc-trunk -O3 -msse4 abc.c ; ./a.out
0
$ gcc-8.1 -O3 -msse4 abc.c ; ./a.out
4
$ gcc-trunk -O3 abc.c ; ./a.out
4
$ cat abc.c
void printf();
short a, b, f, g;
int c = 4, d, e = -1L;
long h = 4;
int main() {
long i;
for (; d <= 55; d++) {
g = c >= 2 ? 0 : b << c;
f = g - a;
i = (f ^ 9223372036854775807) < 0 ? f : h;
e &= i;
}
printf("%d\n", e);
}
More information about the Gcc-bugs
mailing list