On 08/01/2013 02:06 PM, Marek Polacek wrote:
SAVE_EXPRs are evaluated only once;
in that COMPOUND_EXPR, when we first encounter SAVE_EXPR <x> and
call get_initialized_tmp_var, we get temporary value for it, x.2.
Then, in the second part of the COMPOUND_EXPR, we meet SAVE_EXPR <x>
again, but it already has been resolved, so we don't create any
initialized var for it.

Right. When you have a SAVE_EXPR in a conditional context, you need to make sure that it gets evaluated before the condition.

What we could perhaps do is to move the x.2 = x; initialization
before the condition, so that it's always initialized.  It's not readily
obvious to me how to implement that nicely, but I could try something, if
this is the way to go.  Does anyone have a better idea?

Where are the SAVE_EXPRs coming from? It doesn't seem to me that x needs to be wrapped in a SAVE_EXPR at all in this case. For cases where the SAVE_EXPR is needed and not used in the test, you could add the SAVE_EXPR before the condition with a COMPOUND_EXPR.

Jason

Reply via email to