From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 76562 invoked by alias); 17 Sep 2018 17:10:45 -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 76541 invoked by uid 89); 17 Sep 2018 17:10:45 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy= 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; Mon, 17 Sep 2018 17:10:43 +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 w8HHAbJv029379 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 17 Sep 2018 13:10:42 -0400 Received: by simark.ca (Postfix, from userid 112) id 197E01E75F; Mon, 17 Sep 2018 13:10:37 -0400 (EDT) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id 433451E175; Mon, 17 Sep 2018 13:10:33 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 17 Sep 2018 17:10:00 -0000 From: Simon Marchi To: Keith Seitz Cc: Simon Marchi , gdb-patches@sourceware.org Subject: Re: [PATCH] Fix use-after-move in compile/compile-cplus-types.c In-Reply-To: <539a8428-a038-aeb7-0a1c-edbe99cda98d@redhat.com> References: <82a8995b-fd73-ad0b-ed82-64cdb0b54272@redhat.com> <20180917135203.10368-1-simon.marchi@ericsson.com> <539a8428-a038-aeb7-0a1c-edbe99cda98d@redhat.com> Message-ID: X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.3.6 X-IsSubscribed: yes X-SW-Source: 2018-09/txt/msg00588.txt.bz2 On 2018-09-17 11:25, Keith Seitz wrote: > On 09/17/2018 06:52 AM, Simon Marchi wrote: >> Patch >> >> d82b3862f12 ("compile: Remove non-const reference parameters") >> >> introduced a regression in compile/compile-cplus-types.c. The >> new_scope >> variable in compile_cplus_instance::enter_scope is used after it was >> std::moved. This patch fixes it by referring to the back of the >> vector >> where it was moved instead. >> >> gdb/ChangeLog: >> >> * compile/compile-cplus-types.c >> (compile_cplus_instance::enter_scope): Don't use new_scope after >> std::move. > > That LGTM. [Although I would have used a const reference to it > everywhere, but > six of one, ...] Yeah, I thought about that too, but then I didn't know what to name the new variable, since "new_scope" is already taken. So in the end I chose the solution where I didn't have to choose a name :). > PS. Reminder: IANAM, but you are. So please approve your patch. :-) Thanks for taking a look, I am pushing it. Simon