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

            Bug ID: 117123
           Summary: [12/13/14/15 regression] Generated code at -Os on
                    trunk is larger than GCC 14.4
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dccitaliano at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/ern8cbPzr

Inline code:

struct Potato {                                                                 
  int size;                                                                     
  bool isMashed;                                                                
};                                                                              

int dont_be_here();                                                             

int patatino(int a) {
  if (a > 5 && a % 2 == 0 && a != 10) {
    return a * 2;
  } else {
    Potato spud;
    spud.size = a;
    spud.isMashed = false;

    for (int i = 0; i < 10; i++) {
      if (i > 10 && i < 5 && a == -1) {
        for (int j = 0; j < 5; j++) {
          spud.size += j;
        }
      }
    }

    // Added a loop that never gets executed with a complex condition and
statement inside
    for (int k = 0; k < 10 && a == -100 && spud.size > 1000; k++) {
      for (int l = 0; l < 5; l++) {
        spud.size += l * k;
      }
    }

    // Modified to add a loop that never gets executed with a call to
dont_be_here()
    for (int m = 0; m < 10 && a == -1000 && spud.size < -1000; m++) {
      dont_be_here();
    }

    // Modified function with added conditional statement
    if (a > 10000 && spud.size < -10000) {
      spud.size *= 2;
    }

    // Added another loop that never gets executed with a complex condition and
statement inside
    for (int n = 0; n < 10 && a == -2000 && spud.size > 2000; n++) {
      for (int o = 0; o < 5; o++) {
        spud.size -= o * n;
      }
    }

    return spud.size;
  }
}

Reply via email to