This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Properly take address of SAVE_EXPR
- From: Per Bothner <per at bothner dot com>
- To: Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sat, 22 Dec 2001 16:11:47 -0800
- Subject: Re: Properly take address of SAVE_EXPR
- References: <10112222335.AA15302@vlsi1.ultra.nyu.edu>
Richard Kenner wrote:
> You don't only take addresses of things that are lvalues.
> You can take the address of a constant, for example.
It depends whether we are talking about semantics ("abstract
syntax tree") or a more medium-level (ABI) representation.
Semantically, you can take the address of an initialized read-only
anonymous variable. But that is not the same thing as a constant,
at least conceptually. (Some languages may magically coerce the
latter into the former, but that is a front-end issue, not a tree
issue.)
Now the ABI for dealing with some constant dats structures
might require them to be passed by reference. But this I think
is another argument why SAVE_EXPR has poorly-defined semantics,
and should be deprecated in favor of (a proposed) LET_EXPR.
If you need to take the address of a constant, I think it should
be done this way:
let TEMP : TYPE := CONSTANT
in .... ADDR_EXPR (TEMP) ... ADDR_EXPR (TEMP)
--
--Per Bothner
per@bothner.com http://www.bothner.com/per/