Is VIEW_CONVERT_EXPR an lvalue? (was Re: RFA (fold): PATCH for c++/49290 (folding *(T*)(ar+10)))

Jason Merrill jason@redhat.com
Sun Jun 12 22:42:00 GMT 2011


On 06/12/2011 06:59 AM, Richard Guenther wrote:
> The please provide a specification on what a VIEW_CONVERT_EXPR does
> to type-based alias analysis.

If the alias set of the VIEW_CONVERT_EXPR type the same as the set for 
the operand, ignore it; if it's a subset, handle it like a 
COMPONENT_REF; otherwise ignore the operand for TBAA.

It seems like get_alias_set currently gets this backwards; it's ignoring 
outer COMPONENT_REFs instead of the inner structure.

> Yes, we do handle lvalue VIEW_CONVERT_EXPRs, but that is for Ada
> which uses it for aggregates.

It also seems to be widely used for vectors, but perhaps that's only for 
rvalues.

> I don't want us to add more lvalue
> VIEW_CONVERT_EXPR cases, especially not for register types.

Then how do we convert an int lvalue to a volatile int lvalue?

> /* Represents viewing something of one type as being of a second type.
>    This corresponds to an "Unchecked Conversion" in Ada and roughly to
>    the idiom *(type2 *)&X in C.

Right, that's why I thought it was an lvalue.

>    This code may also be used within the LHS of a MODIFY_EXPR

And this.

Jason



More information about the Gcc-patches mailing list