This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Q's about use of is_gimple_reg_rhs/is_gimple_tmp_var
- From: Diego Novillo <dnovillo at redhat dot com>
- To: Nathanael Nerode <neroden at fastmail dot fm>
- Cc: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Mon, 16 Aug 2004 08:08:00 -0400
- Subject: Re: Q's about use of is_gimple_reg_rhs/is_gimple_tmp_var
- Organization: Red Hat Canada
- References: <20040816075648.GA2706@fastmail.fm>
On Mon, 2004-08-16 at 03:56, Nathanael Nerode wrote:
> In is_gimple_reg_rhs, it says:
>
> /* If the RHS of the MODIFY_EXPR may throw or make a nonlocal goto and
> the LHS is a user variable, then we need to introduce a temporary.
> ie temp = RHS; LHS = temp.
>
> This way the optimizers can determine that the user variable is
> only modified if evaluation of the RHS does not throw. */
>
> Is this really referring to "user variables" (!DECL_ARTIFICIAL), and is
> it essentially for debugging?
>
It's for correctness, not debugging:
V = foo();
If the call to foo does throw, the semantics of throw imply that the
assignment to V must not execute. That's why we expand this to:
tmp = foo ();
V = tmp;
Diego.