This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Question on scalar replacement
On Mon, 14 Jun 2004 10:17:34 -0400, Diego Novillo <dnovillo@redhat.com> wrote:
> On Mon, 2004-06-14 at 10:07, Richard Kenner wrote:
>> Ah, sorry. Try this:
>>
>> - tree var = TREE_OPERAND (stmt, 0);
>> + tree var = get_base_address (TREE_OPERAND (stmt, 0));
>>
>> Yeah, that does it. And also fixes a half dozen similar cases in
>> other Ada RTS files. I can now compile the first 18 files without
>> ICE, error, or warning.
>>
> Sure. Now, that I think a bit more about this, it's surprising that we
> haven't run into this before. I don't see anything wrong with
> MODIFY_EXPR <COMPONENT_REF, CALL_EXPR> wrt GIMPLE, but I do know that we
> never get this in C. The C gimplifier always creates a scalar LHS:
>
> a.f = foo ()
>
> is gimplified into
>
> temp = foo ()
> a.f = temp
If a.f has scalar type, this is what we want. If it is an aggregate, we
probably don't, which is what my recent gimplify_modify_expr patch was
intended to fix.
> Jason, is a.f = foo() valid GIMPLE? If not, then the bug is in the
> gimplifier. Otherwise, the patch I sent should be OK.
It's valid for aggregate_type_p type.
Jason