public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Fix assertion failure in coerce_unspec_val_to_type
@ 2019-05-14 22:11 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2019-05-14 22:11 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c408a94f8115767ea7e6aa1a75bc59ea5ae960fa

commit c408a94f8115767ea7e6aa1a75bc59ea5ae960fa
Author: Tom Tromey <tromey@adacore.com>
Date:   Fri May 10 10:40:15 2019 -0600

    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  <tromey@adacore.com>
    
    	* ada-lang.c (coerce_unspec_val_to_type): Only set address when
    	value is not lval_memory.

Diff:
---
 gdb/ChangeLog  | 5 +++++
 gdb/ada-lang.c | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 095a6c2..c82d70f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
 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.
+
+2019-05-14  Tom Tromey  <tromey@adacore.com>
+
 	* solib.c (info_sharedlibrary_command): Style the file name.
 
 2019-05-14  Alan Hayward  <alan.hayward@arm.com>
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index dee3a83..23197f6 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;
     }
 }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-05-14 22:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-14 22:11 [binutils-gdb] Fix assertion failure in coerce_unspec_val_to_type Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).