[cfe-commits] [PATCH] Fix struct assignment from "piecemeal" aggregates

John McCall rjmccall at apple.com
Fri Jun 17 14:32:08 PDT 2011


On Jun 17, 2011, at 2:13 PM, Eli Friedman wrote:
> On Fri, Jun 17, 2011 at 11:21 AM, Douglas Gregor <dgregor at apple.com> wrote:
>> The attached patch fixes the root of the problem: by detecting when the rhs is something that will build an aggregate piecemeal, we can generate safer code that creates a temporary for the rhs and then copies it over. In the common case (rhs builds a full aggregate value in one shot), we still perform the optimization.
>> 
>> Comments appreciated!
> 
> I'm sort of uncomfortable with the blacklist approach... are you sure
> you're actually catching all the unsafe cases?

I agree;  we should be white-listing expressions that are actually safe
to emit directly like this.  The only cases that come to mind would be
(expressions that produce their value via one of)
  an lvalue-to-rvalue conversion 
  a rvalue member expression
  ???

Alternatively, we could propagate a "result is potentially aliased"
bit in AggValueSlot.

John.



More information about the cfe-commits mailing list