https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88280
Bug ID: 88280 Summary: missing folding of logical and bitwise AND Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- The following functions should all produce the same code with optimisations on (it is the same if `a' is replaced with a constant) ------------------------- int e(int i, int a) { return i && i & a; } int f(int i, int a) { return i & a && i; } int g(int i, int a) { int j = i & a; return j && i; } int h(int i, int a) { int j = i & a; return i && j; } ------------------------- But currently only f produces good assembly: f(int, int): xor eax, eax test edi, esi setne al ret