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

            Bug ID: 120035
           Summary: Loops are not optimized when "unsigned i" is used
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mcccs at gmx dot com
  Target Milestone: ---

This code:

__attribute__((noipa)) bool g(int i) {
    return true;
}
__attribute__((noipa)) bool f(){
    bool retval = false;
    for(long unsigned int i=0; i< (1ul << 60); ++i)
        retval = retval || g(i);
    return retval;
}

int main() {
    return (int) !f();
}

With Richard's fix today for pr120003 is optimized, but only when "unsigned" is
removed and "ul" is replaced with "l".

It's also optimized when I add "signed" to i

There should be no difference between a signed i and an unsigned i

Reply via email to