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

--- Comment #20 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #19)
> gcc.dg/torture/pr52244.c ICEs on the generated
> 
>   VIEW_CONVERT_EXPR<union u_t>(u) = bar ();
> 
> since V_C_E on the LHS are generally unwanted (but Ada has them for
> aggregates
> just not in outermost position).  What's always possible on the LHS is
> to use a BIT_FIELD_REF.

So the issue here is that 'u' is a register, not that V_C_E on the LHS
are invalid.  And we don't have a "general" DECL_GIMPLE_REG_P we could
unset since that's just usd for complex and vector types.  Which means
we'd have to artifically set TREE_ADDRESSABLE on the replacement.  It
isn't grp_partial_lhs so SRA doesn't do that.

In the case of a call we can't move the V_C_E to the RHS so we'd
really need to keep the call and insert a compensation assignment.

  orig = bar ();
  u = VIEW_CONVERT <regtype> (orig);

but that doesn't work for a partial access since we're clobbering the
whole replacement here.  A BIT_FIELD_REF on the LHS for a _register_
is also not possible so the write to a part via an incompatible type
would represent itself as

  orig_full = VIEW_CONVERT <orig_type> (repl_full);
  <original stmt with partial write to orig_full>
  repl_full = VIEW_CONVERT <repl_type> (orig_full);

which of course makes this highly suboptimal (but at least correct which
is what we should focus on right now).

Reply via email to