https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126857

            Bug ID: 126857
           Summary: Redundant bit set after bit test came positive
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: uis9936 at gmail dot com
  Target Milestone: ---

void g();
int f(int a, int b) {
    bool t = false;
    t = (a >> b) & 1;
    if(t) {
        a = a | (1 << b);
        g();
    }
    return a;
}

This came up during testing done for bug 122018. I guess this is middle-end
problem. IMO struct bitfields are better construct, but bitfields in integer is
more wide-spread pattern.

Reply via email to