https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127113
Bug ID: 127113
Summary: [13-17 Regression] wrong code at -O2
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: xxs_chy at outlook dot com
Target Milestone: ---
Reproducer: https://godbolt.org/z/7PMvM68Kf
Reduced case:
#include <stdint.h>
union u0 {
_Bool f0;
uint32_t f1;
uint8_t f2;
};
uint16_t g31;
static void f12(union u0 a0, uint16_t a3)
{
if (a3) goto lbl_br19;
a0.f1 = ~g31;
a0.f2 = a0.f1;
lbl_br19:
if ((int8_t)a0.f2 == -1LL) return;
__builtin_abort();
}
int main() { f12((union u0){ 1 }, g31); }
This case aborts at -O2, but should terminate normally.