[Bug tree-optimization/126486] New: codesize regression by 17.6and potential miss optimziation cauded by r15-6657

"liuhongt at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126486

            Bug ID: 126486
           Summary: codesize regression by 17.6and potential miss
                    optimziation cauded by r15-6657
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: liuhongt at gcc dot gnu.org
  Target Milestone: ---

testcase 

```c
int g(int N_dims, int *actual_indices, const long *input_array_dims, int
max_iter) {
  int sum = 0, iter = 0, k, j, product;
  while (iter < max_iter) {
    sum = actual_indices[0];
    for (k = N_dims-1; k > 0; k--) {
      product = 1;
      for (j = k-1; j >= 0; j--)
        product *= input_array_dims[j];
      sum += actual_indices[k] * product;
    }
    iter++;
  }
  return sum;
}
```

Compile: `gcc -O2 -march=x86-64-v3 -c pr-testcase.c` (the `-march` is not
required;
plain `-O2` reproduces too).
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.