[Bug tree-optimization/100810] New: wrong code at -O1 and above on x86_64-linux-gnu
zhendong.su at inf dot ethz.ch
gcc-bugzilla@gcc.gnu.org
Fri May 28 08:59:21 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100810
Bug ID: 100810
Summary: wrong code at -O1 and above on x86_64-linux-gnu
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: zhendong.su at inf dot ethz.ch
Target Milestone: ---
[511] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/suz-local/software/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--prefix=/local/suz-local/software/local/gcc-trunk --enable-languages=c,c++
--disable-werror --enable-multilib --with-system-zlib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210528 (experimental) [master revision
4774807e6e5:0e2d976f72b:cd62d089f6021fd1ad4537b8182836d15b14514f] (GCC)
[512] %
[512] % gcctk -O0 small.c; ./a.out
[513] %
[513] % gcctk -O1 small.c
[514] % ./a.out
Aborted
[515] %
[515] % cat small.c
int a, b = 1, c = 1, e, f = 1, g, h, j;
volatile int d;
static void k() {
int i;
h = b;
if (c && a >= 0) {
while (a) {
i++;
h--;
}
if (g)
for (h = 0; h < 2; h++)
;
if (!b)
i &&d;
}
}
static void l() {
for (; j < 1; j++)
if (!e && c && f)
k();
}
int main() {
if (f)
l();
if (h != 1)
__builtin_abort();
return 0;
}
More information about the Gcc-bugs
mailing list