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

            Bug ID: 88314
           Summary: range calculation of shift
           Product: gcc
           Version: 9.0
            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: ---

gcc is not able to determine that the possible values of res are 0, 8, 16, 32
and so the following function is not optimized :

------------------
bool f(bool a, bool b, bool c) {
    int res = (a + b) << (1 + c) << 2;

    return res > 0 && res < 8; 
}
-----------------

Reply via email to