summaryrefslogtreecommitdiff
path: root/gprofng
diff options
context:
space:
mode:
authorVladimir Mezentsev <vladimir.mezentsev@oracle.com>2022-04-28 22:26:51 -0700
committerVladimir Mezentsev <vladimir.mezentsev@oracle.com>2022-04-29 14:03:12 -0700
commit835e063d3a0d08a85862e3cdf217773f524cd006 (patch)
tree0f51b2bfc439de40c921e9101a0596a38acb65e8 /gprofng
parentc7a73fa4dc7c7e9589b144e9ff9d9103b78ed362 (diff)
downloadbinutils-gdb-835e063d3a0d08a85862e3cdf217773f524cd006.tar.gz
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.
Diffstat (limited to 'gprofng')
-rw-r--r--gprofng/src/Expression.cc34
-rw-r--r--gprofng/src/Expression.h2
2 files changed, 18 insertions, 18 deletions
diff --git a/gprofng/src/Expression.cc b/gprofng/src/Expression.cc
index 49c94a80cd2..df440927e79 100644
--- a/gprofng/src/Expression.cc
+++ b/gprofng/src/Expression.cc
@@ -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)
{
diff --git a/gprofng/src/Expression.h b/gprofng/src/Expression.h
index 7542853fd64..29d3e4e720f 100644
--- a/gprofng/src/Expression.h
+++ b/gprofng/src/Expression.h
@@ -166,9 +166,7 @@ private:
bool getVal (int propId, Context *ctx);
bool bEval (Context *ctx);
-
bool hasLoadObject ();
- void fixupValues ();
OpCode op;
Value v;