This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Fix stmtexpr1.C on Thumb


On Tue, 2004-01-06 at 11:22, Eric Botcazou wrote:
> > This patch removes the hacks from c_expand_expr, and changes
> > store_expr to check to see if the target is an invalid memory address.
> > If so, the copy is not done.
> 
> I think the change to store_expr is wrong: it removes the clause that 
> guarantees that the copy will be done for a VAR_DECL if target != 
> DECL_RTL_IF_SET (exp).
> 
> Target might be an invalid address and have nothing to do with the VAR_DECL.  
> In this case, the copy should be done.

Here's the patch I checked in for this problem.

Fundamentally, this approach should *work* (unlike the original version,
or my attempted fix, both of which were highly heuristical), but it's
not very pretty.

Fundamentally, to do better, store_expr needs a way to tell expand_expr
"put the value of this expression in this location here, and without
copying it through intermediate locations".  Technically, we really only
need that for aggregates that live in memory, which would seem to be the
easy case -- it's not like you should really have to copy things about.

The alternative  would seem to be to have the expr_size hook say "this
is never the kind of thing that should be copied", and have store_expr
just assume that if it shouldn't be copied, then expand_expr must have
put it in the right place.  That seems less robust.

Tested on i686-pc-linug-gnu, on arm-none-elf (with -mthumb), and by
running the compat tests on sparc-sun-solaris2.8.  Applied on the
mainline.

-- 
Mark Mitchell <mark@codesourcery.com>
CodeSourcery, LLC

Attachment: diffs
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]