From: vladimir.mezentsev@oracle.com
To: binutils@sourceware.org
Subject: [PATCH] gprofng: assertion in gprofng/src/Expression.cc:139
Date: Thu, 28 Apr 2022 22:31:43 -0700 [thread overview]
Message-ID: <20220429053143.2424859-1-vladimir.mezentsev@oracle.com> (raw)
From: Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
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.
---
gprofng/src/Expression.cc | 34 ++++++++++++++++++----------------
gprofng/src/Expression.h | 2 --
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;
--
2.27.0
reply other threads:[~2022-04-29 5:31 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220429053143.2424859-1-vladimir.mezentsev@oracle.com \
--to=vladimir.mezentsev@oracle.com \
--cc=binutils@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).