This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 06/10] vla: update type from newly created value


Constructing a value based on a type and address might change the type
of the newly constructed value. Thus re-fetch type via value_type to ensure
we have the correct type at hand.

2013-10-18  Sanimir Agovic  <sanimir.agovic@intel.com>
            Keven Boell  <keven.boell@intel.com>

	* valops.c (value_ind): Re-fetch type from value.
	* value.c (coerce_ref): Re-fetch type from value.

Change-Id: Ice9ae63215f637c4b99babf0f108e7b5b58988cd
---
 gdb/valops.c |    1 +
 gdb/value.c  |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/gdb/valops.c b/gdb/valops.c
index 15fd7c3..6706d9f 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -1610,6 +1610,7 @@ value_ind (struct value *arg1)
 			      (value_as_address (arg1)
 			       - value_pointed_to_offset (arg1)));
 
+      enc_type = value_type (arg2);
       return readjust_indirect_value_type (arg2, enc_type, base_type, arg1);
     }
 
diff --git a/gdb/value.c b/gdb/value.c
index b9266db..ce778ea 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -3360,6 +3360,7 @@ coerce_ref (struct value *arg)
   retval = value_at_lazy (enc_type,
                           unpack_pointer (value_type (arg),
                                           value_contents (arg)));
+  enc_type = value_type (retval);
   return readjust_indirect_value_type (retval, enc_type,
                                        value_type_arg_tmp, arg);
 }
-- 
1.7.0.7


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]