gprofng: assertion in gprofng/src/Expression.cc:139

gprofng/ChangeLog
2022-04-28  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	PR gprofng/29102
	* src/Expression.h: Remove fixupValues.
	* src/Expression.cc (Expression::copy): Fix a bug.
This commit is contained in:
Vladimir Mezentsev
2022-04-28 22:26:51 -07:00
parent c7a73fa4dc
commit 835e063d3a
2 changed files with 18 additions and 18 deletions

View File

@@ -91,12 +91,18 @@ Expression::Expression (const Expression &rhs)
op = rhs.op;
arg0 = NULL;
arg1 = NULL;
v = Value (rhs.v);
if (rhs.arg0)
arg0 = rhs.arg0->copy ();
{
arg0 = rhs.arg0->copy ();
if (v.next)
{
assert (arg0 && v.next == &(rhs.arg0->v));
v.next = &(arg0->v);
}
}
if (rhs.arg1)
arg1 = rhs.arg1->copy ();
v = Value (rhs.v);
fixupValues ();
}
Expression::Expression (const Expression *rhs)
@@ -114,12 +120,18 @@ Expression::copy (const Expression *rhs)
delete arg1;
arg0 = NULL;
arg1 = NULL;
v = Value (rhs->v);
if (rhs->arg0)
arg0 = rhs->arg0->copy ();
{
arg0 = rhs->arg0->copy ();
if (v.next)
{
assert (arg0 && v.next == &(rhs->arg0->v));
v.next = &(arg0->v);
}
}
if (rhs->arg1)
arg1 = rhs->arg1->copy ();
v = Value (rhs->v);
fixupValues ();
}
Expression &
@@ -131,16 +143,6 @@ Expression::operator= (const Expression &rhs)
return *this;
}
void
Expression::fixupValues ()
{
if (v.next)
{
assert (arg0 && v.next == &(arg0->v));
v.next = &(arg0->v);
}
}
bool
Expression::getVal (int propId, Context *ctx)
{

View File

@@ -166,9 +166,7 @@ private:
bool getVal (int propId, Context *ctx);
bool bEval (Context *ctx);
bool hasLoadObject ();
void fixupValues ();
OpCode op;
Value v;