[Bug tree-optimization/101009] [10/11/12 Regression] wrong code with "-O3 -fno-tree-sra"

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jun 11 07:21:44 GMT 2021


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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[12 Regression] wrong code  |[10/11/12 Regression] wrong
                   |with "-O3 -fno-tree-sra"    |code with "-O3
                   |                            |-fno-tree-sra"
   Target Milestone|12.0                        |10.4
      Known to work|                            |9.4.0

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
With -O2 -fno-tree-sra -fno-tree-pre -ftree-loop-distribution even GCC 10
miscompiles the code.  For dg-torture:

/* { dg-do run } */
/* { dg-additional-options "-fno-tree-sra -fno-tree-pre
-ftree-loop-distribution" } */

struct a {
  unsigned b;
  unsigned c;
} e, *f = &e;
int d = 1;
int main() {
  for (; d; d--) {
    struct a g[] = {{2, 1}, {2, 1}};
    *f = g[1];
  }
  if (e.c != 1)
    __builtin_abort ();
  return 0;
}


More information about the Gcc-bugs mailing list