Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [RFA] Clear entire "location" in value constructor
Date: Tue, 10 Apr 2018 17:37:00 -0000	[thread overview]
Message-ID: <20180410173704.21702-1-tom@tromey.com> (raw)

My recent change to allocate values with "new" may have introduced a
small bug.  In particular, the previous code allocated with XCNEW, but
the new code only clears a part of the "location" field in the
constructor.  I didn't try very hard to actually trigger a bug here,
the problem remains theoretical.

This patch changes the constructor to clear the entire "location".

Regression tested by the buildbot.

2018-04-10  Tom Tromey  <tom@tromey.com>

	* value.c (value::value): Clear "location".
---
 gdb/ChangeLog | 4 ++++
 gdb/value.c   | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d46ecdd120..8cc1486c87 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2018-04-10  Tom Tromey  <tom@tromey.com>
+
+	* value.c (value::value): Clear "location".
+
 2018-04-10  Pedro Alves  <palves@redhat.com>
 
 	* gdbthread.h (finish_thread_state_cleanup): Delete declaration.
diff --git a/gdb/value.c b/gdb/value.c
index 12aa2b8bb4..64e3eaca22 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -180,7 +180,7 @@ struct value
       type (type_),
       enclosing_type (type_)
   {
-    location.address = 0;
+    memset (&location, 0, sizeof (location));
   }
 
   ~value ()
-- 
2.13.6


             reply	other threads:[~2018-04-10 17:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-10 17:37 Tom Tromey [this message]
2018-04-25 15:33 ` Tom Tromey
2018-05-09 15:40   ` Tom Tromey
2018-05-25 17:30     ` Tom Tromey
2018-05-25 19:53 ` Simon Marchi
2018-05-25 21:46   ` Tom Tromey
2018-05-25 22:43     ` Pedro Alves

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=20180410173704.21702-1-tom@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@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