From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 127810 invoked by alias); 25 May 2018 19:36:10 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 127800 invoked by uid 89); 25 May 2018 19:36:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.9 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=wondered X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 25 May 2018 19:36:09 +0000 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id w4PJa2PO018059 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 25 May 2018 15:36:07 -0400 Received: by simark.ca (Postfix, from userid 112) id B0A9A1F21B; Fri, 25 May 2018 15:36:02 -0400 (EDT) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id C04C21E75F; Fri, 25 May 2018 15:36:01 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 25 May 2018 19:53:00 -0000 From: Simon Marchi To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [RFA] Clear entire "location" in value constructor In-Reply-To: <20180410173704.21702-1-tom@tromey.com> References: <20180410173704.21702-1-tom@tromey.com> Message-ID: <935d0c19b292f0793d89a2029f12cdc8@polymtl.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.3.6 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Fri, 25 May 2018 19:36:02 +0000 X-IsSubscribed: yes X-SW-Source: 2018-05/txt/msg00701.txt.bz2 On 2018-04-10 13:37, Tom Tromey wrote: > 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 () Ah, I stumbled upon that code recently and wondered why only location.address was set. Either memset or {} is fine with me. Simon