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

--- Comment #4 from Martin Jambor <jamborm at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #3)
> ...I also wonder why SRA does not elide the aggregate copy.

SRA has a special condition not to attempt to totally scalarize array
of chars, so that it does not interfere with bigger types
placement-new placed in those.

It is true that artificially removing this condition would avoid the
problem though.  However, the IL after esra would look like the
following:

  <bb 2> :
  SR.1_3 = 0;
  SR.2_8 = 0;
  SR.3_9 = 0;
  SR.4_10 = 0;
  SR.5_11 = 0;
  SR.6_12 = 0;
  SR.7_13 = 0;
  SR.8_14 = 0;
  SR.1_15 = 0;
  SR.2_16 = 0;
  SR.3_17 = 0;
  SR.4_18 = 0;
  SR.5_19 = 0;
  SR.6_20 = 0;
  SR.7_21 = 0;
  SR.8_22 = 0;
  D.10899.a._M_elems[0] = SR.1_15;
  D.10899.a._M_elems[1] = SR.2_16;
  D.10899.a._M_elems[2] = SR.3_17;
  D.10899.a._M_elems[3] = SR.4_18;
  D.10899.a._M_elems[4] = SR.5_19;
  D.10899.a._M_elems[5] = SR.6_20;
  D.10899.a._M_elems[6] = SR.7_21;
  D.10899.b = SR.8_22;
  return D.10899;

Reply via email to