https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100923
Bug ID: 100923
Summary: wrong code at -Os 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: ---
[560] % 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 20210605 (experimental) [master revision
549d7f4310f:e97b11a9189:f31729d794c4150f6cba97f33ec125e180abd7dd] (GCC)
[561] %
[561] % gcctk -O1 small.c; ./a.out
[562] %
[562] % gcctk -Os small.c
[563] % ./a.out
Floating point exception
[564] %
[564] % cat small.c
int a = 1, b, c, *d = &a, *e = &a, f;
void g(int h) {}
void k(int *l) {
int ***j;
if (c) {
*j = &l;
***j;
}
g(*l);
*e = f;
if (*l) {
int i = b / a;
a = i;
}
}
int main() {
k(d);
return 0;
}