[Bug tree-optimization/108166] New: [12/13 Regression] Wrong code with -O2
vsevolod.livinskiy at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sun Dec 18 19:46:01 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108166
Bug ID: 108166
Summary: [12/13 Regression] Wrong code with -O2
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: vsevolod.livinskiy at gmail dot com
Target Milestone: ---
Link to the Compiler Explorer: https://godbolt.org/z/j8coqj375
Reproducer:
#include <stdio.h>
bool a, b;
int d, c;
const int &e(const int &f, const int &g) { return !f ? f : g; }
int main() {
c = e(b, 0) > ((b ? d : b) ?: 8);
a = b ? d : b;
printf("%d\n", a);
if (a != 0)
__builtin_abort();
}
Error:
>$ g++ -O2 driver.cpp && ./a.out
1
Aborted (core dumped)
>$ g++ -O0 driver.cpp && ./a.out
0
gcc version 13.0.0 20221216 (2fdc8546b5c6cb1fe254e40b5bdd19ed6fbb44da)
More information about the Gcc-bugs
mailing list