From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 77749 invoked by alias); 14 May 2019 20:19:22 -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 77734 invoked by uid 89); 14 May 2019 20:19:22 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-17.9 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=answered X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 14 May 2019 20:19:21 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id C4A7211653E; Tue, 14 May 2019 16:19:19 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 3zKN3rglMM2E; Tue, 14 May 2019 16:19:19 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 926D61163DF; Tue, 14 May 2019 16:19:19 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id A565185493; Tue, 14 May 2019 13:19:17 -0700 (PDT) Date: Tue, 14 May 2019 20:19:00 -0000 From: Joel Brobecker To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] Fix assertion failure in coerce_unspec_val_to_type Message-ID: <20190514201917.GA32616@adacore.com> References: <20190514192939.4138-1-tromey@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190514192939.4138-1-tromey@adacore.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-SW-Source: 2019-05/txt/msg00338.txt.bz2 > coerce_unspec_val_to_type does: > > set_value_address (result, value_address (val)); > > However, this is only valid for lval_memory. This patch changes this > code to only set the address for lval_memory values. > > This seems like an ordinary oversight in coerce_unspec_val_to_type, > and a test case would be difficult to write, so I'm submitting it > without a test case. > > Tested on x86-64 Fedora 29; plus using an Ada program that exhibits > the bug (but which cannot be shared). > > gdb/ChangeLog > 2019-05-14 Tom Tromey > > * ada-lang.c (coerce_unspec_val_to_type): Only set address when > value is not lval_memory. This is OK. Tom and I discussed it internally at AdaCore, and one of the questions that Tom answered for me was the fact that it's OK to only handle the case where the value is an lval_memory. For the other cases, the value's location is handled a little earlier in set_value_component_location. > --- > gdb/ChangeLog | 5 +++++ > gdb/ada-lang.c | 3 ++- > 2 files changed, 7 insertions(+), 1 deletion(-) > > diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c > index dee3a83f98c..23197f60340 100644 > --- a/gdb/ada-lang.c > +++ b/gdb/ada-lang.c > @@ -672,7 +672,8 @@ coerce_unspec_val_to_type (struct value *val, struct type *type) > set_value_component_location (result, val); > set_value_bitsize (result, value_bitsize (val)); > set_value_bitpos (result, value_bitpos (val)); > - set_value_address (result, value_address (val)); > + if (VALUE_LVAL (result) == lval_memory) > + set_value_address (result, value_address (val)); > return result; > } > } > -- > 2.20.1 -- Joel