From: Tom Tromey Date: Fri, 10 May 2019 16:40:15 +0000 (-0600) Subject: Fix assertion failure in coerce_unspec_val_to_type X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c408a94f8115767ea7e6aa1a75bc59ea5ae960fa;p=binutils-gdb.git Fix assertion failure in coerce_unspec_val_to_type 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. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 095a6c2d635..c82d70fc8ce 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2019-05-14 Tom Tromey + + * ada-lang.c (coerce_unspec_val_to_type): Only set address when + value is not lval_memory. + 2019-05-14 Tom Tromey * solib.c (info_sharedlibrary_command): Style the file name. 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; } }