https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94838
Bug ID: 94838 Summary: Failure to optimize out useless zero-ing after register was already zero-ed Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: gabravier at gmail dot com Target Milestone: --- int f(bool b, int *p) { return b && *p; } GCC generates this with -O3: f(bool, int*): xor eax, eax test dil, dil je .L1 mov edx, DWORD PTR [rsi] xor eax, eax ; This can be removed, since eax is already 0 here test edx, edx setne al .L1: ret