From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 129997 invoked by alias); 12 Oct 2018 04:10:28 -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 129916 invoked by uid 89); 12 Oct 2018 04:10:27 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=kevin X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 12 Oct 2018 04:10:26 +0000 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2C92AC0528B9 for ; Fri, 12 Oct 2018 04:10:25 +0000 (UTC) Received: from pinnacle.lan (ovpn-117-243.phx2.redhat.com [10.3.117.243]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 114B380F97 for ; Fri, 12 Oct 2018 04:10:25 +0000 (UTC) Date: Fri, 12 Oct 2018 04:10:00 -0000 From: Kevin Buettner To: gdb-patches@sourceware.org Subject: Re: [PATCH 5/8] Fix latent bug in msp430-tdep.c Message-ID: <20181011211023.72beeaf9@pinnacle.lan> In-Reply-To: <20180923040814.27941-6-tom@tromey.com> References: <20180923040814.27941-1-tom@tromey.com> <20180923040814.27941-6-tom@tromey.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2018-10/txt/msg00284.txt.bz2 On Sat, 22 Sep 2018 22:08:11 -0600 Tom Tromey wrote: > -Wshadow=local found this latent bug. msp430-tdep.c does: > > const gdb_byte *arg_bits; > { > /* Aggregates of any size are passed by reference. */ > gdb_byte struct_addr[4]; > [... > arg_bits = struct_addr; > } > ... use arg_bits > > Here, arg_bits can point to an object that's gone out of scope. > > The fix is to hoist the inner "struct_addr" buffer to an outer scope, > and rename it to avoid shadowing. > > gdb/ChangeLog > 2018-09-22 Tom Tromey > > * msp430-tdep.c (msp430_push_dummy_call): Rename inner > "structs_addr" and hoist declaration. LGTM. Kevin