Fix segfault when incrementing whole vector values.

Also removed RefExpr::Eval(Val*) method since it was never called
(Clang emitted warning about this hiding overloaded virtual function
UnaryExpr::Eval(Frame*)) and doesn't appear to be necessary even if it
was called to avoid the default vector handling of UnaryExpr::Eval
(as the comment suggests as the intention).
This commit is contained in:
Jon Siwek 2012-07-13 14:32:50 -05:00
parent 8279de25c9
commit 353393f9bd
5 changed files with 67 additions and 11 deletions

View file

@ -1035,12 +1035,10 @@ Val* IncrExpr::Eval(Frame* f) const
{
Val* new_elt = DoSingleEval(f, elt);
v_vec->Assign(i, new_elt, this, OP_INCR);
Unref(new_elt); // was Ref()'d by Assign()
}
else
v_vec->Assign(i, 0, this, OP_INCR);
}
// FIXME: Is the next line needed?
op->Assign(f, v_vec, OP_INCR);
}
@ -2402,11 +2400,6 @@ Expr* RefExpr::MakeLvalue()
return this;
}
Val* RefExpr::Eval(Val* v) const
{
return Fold(v);
}
void RefExpr::Assign(Frame* f, Val* v, Opcode opcode)
{
op->Assign(f, v, opcode);

View file

@ -608,10 +608,6 @@ public:
void Assign(Frame* f, Val* v, Opcode op = OP_ASSIGN);
Expr* MakeLvalue();
// Only overridden to avoid special vector handling which doesn't apply
// for this class.
Val* Eval(Val* v) const;
protected:
friend class Expr;
RefExpr() { }