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

--- Comment #7 from qinzhao at gcc dot gnu.org ---
Or if we add an initialization in the source code as the following:

struct S { int a, b, c, d; };
void bar (int, int, int, int);

void
foo ()
{
  S s = {};
  s.a = 1;
  s.c = 2;
  s.d = 3;
  s.a++;
  s.c++;
  s.d++;
  bar (s.a, s.b, s.c, s.d);
}
with the exactly same options (-O2 -fno-tree-fre -fno-tree-pre
-ftrivial-auto-var-init=pattern -Wuninitialized), the SRA scalarize s.b
correctly as:
  s$a_22 = 0;
  s$b_23 = 0;
  s$c_24 = 0;
  s$d_25 = 0;

and the final optimized tree code is good too:
void foo ()
{
  <bb 2> [local count: 1073741824]:
  bar (2, 0, 3, 4);
  return;

}

So, I suspect that there is a bug in the routine "sra_modify_deferred_init".
will study a little bit more here

Reply via email to