From: Joel Brobecker <brobecker@adacore.com>
To: Tom Tromey <tromey@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Fix assertion failure in coerce_unspec_val_to_type
Date: Tue, 14 May 2019 20:19:00 -0000 [thread overview]
Message-ID: <20190514201917.GA32616@adacore.com> (raw)
In-Reply-To: <20190514192939.4138-1-tromey@adacore.com>
> 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 <tromey@adacore.com>
>
> * 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
prev parent reply other threads:[~2019-05-14 20:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-14 19:29 Tom Tromey
2019-05-14 20:19 ` Joel Brobecker [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190514201917.GA32616@adacore.com \
--to=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=tromey@adacore.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox