From patchwork Tue Apr 10 17:37:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 26676 Received: (qmail 82017 invoked by alias); 10 Apr 2018 17:37:10 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 82006 invoked by uid 89); 10 Apr 2018 17:37:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=theoretical X-HELO: gateway33.websitewelcome.com Received: from gateway33.websitewelcome.com (HELO gateway33.websitewelcome.com) (192.185.146.80) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 10 Apr 2018 17:37:07 +0000 Received: from cm12.websitewelcome.com (cm12.websitewelcome.com [100.42.49.8]) by gateway33.websitewelcome.com (Postfix) with ESMTP id 9B152214A5 for ; Tue, 10 Apr 2018 12:37:06 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id 5xCcfLxRZ9sXi5xCcfLoL6; Tue, 10 Apr 2018 12:37:06 -0500 Received: from 75-166-37-45.hlrn.qwest.net ([75.166.37.45]:51538 helo=pokyo.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1f5xCc-001fH3-7i; Tue, 10 Apr 2018 12:37:06 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA] Clear entire "location" in value constructor Date: Tue, 10 Apr 2018 11:37:04 -0600 Message-Id: <20180410173704.21702-1-tom@tromey.com> X-BWhitelist: no X-Source-L: No X-Exim-ID: 1f5xCc-001fH3-7i X-Source-Sender: 75-166-37-45.hlrn.qwest.net (pokyo.Home) [75.166.37.45]:51538 X-Source-Auth: tom+tromey.com X-Email-Count: 1 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes 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 * 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 + + * value.c (value::value): Clear "location". + 2018-04-10 Pedro Alves * 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 ()