* [PATCH] Fix assertion failure in coerce_unspec_val_to_type
@ 2019-05-14 19:29 Tom Tromey
2019-05-14 20:19 ` Joel Brobecker
0 siblings, 1 reply; 2+ messages in thread
From: Tom Tromey @ 2019-05-14 19:29 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
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.
---
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix assertion failure in coerce_unspec_val_to_type
2019-05-14 19:29 [PATCH] Fix assertion failure in coerce_unspec_val_to_type Tom Tromey
@ 2019-05-14 20:19 ` Joel Brobecker
0 siblings, 0 replies; 2+ messages in thread
From: Joel Brobecker @ 2019-05-14 20:19 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-05-14 20:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-14 19:29 [PATCH] Fix assertion failure in coerce_unspec_val_to_type Tom Tromey
2019-05-14 20:19 ` Joel Brobecker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox