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]

Re: MEM/u trouble


On Tue, Mar 13, 2001 at 09:25:21AM -0500, Richard Kenner wrote:
>     Can I access a (mem/u (addressof ())) this way at least? 
> 
> No since it's usually allocated via a stack slot.

I thought that (mem (addressof ())) means a stack slot has not been assigned
for it yet and it is unclear whether it is actually needed, so IMHO clearing
the /u flag should just kill it for all mems for that addressof and nothing
else.

> 
>     Or do we have to force initialization of the slot at a temporary and
>     then copying it to the const location (that would pessimize the code)?
> 
> I don't understand the original problem.  How did /u get set incorrectly in
> the first place?

In
  foo(const K x) : h(x) {}
x is a const variable (so its VAR_DECLs DECL_RTL got /u) and is addressable
(so it was put_var_into_stack() and got assigned a
(addressof:SI (reg/v/u:SI 63) 62 0x401d5888)).
x is being initialized from a temporary variable (surrounded by TARGET_EXPR)
and expand_expr in the TARGET_EXPR case decides it can optimize things by
simply initializing the temporary variable at the location of x (and thus
avoid copying). But the temporary variable is not const whyle x is.

	Jakub


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