aboutsummaryrefslogtreecommitdiff
path: root/gdb/valops.c
diff options
context:
space:
mode:
authorSanimir Agovic <sanimir.agovic@intel.com>2013-10-14 08:36:13 +0100
committerSanimir Agovic <sanimir.agovic@intel.com>2014-04-11 13:43:51 +0100
commitbcd629a44fff61527430f353cf77e20fe3afc395 (patch)
treeb66b31d1a1fa0db37c61e17b2abeb23222d01b52 /gdb/valops.c
parent04b19544ef6a97b62b2cc4a3170b900e046ab185 (diff)
downloadgdb-bcd629a44fff61527430f353cf77e20fe3afc395.zip
gdb-bcd629a44fff61527430f353cf77e20fe3afc395.tar.gz
gdb-bcd629a44fff61527430f353cf77e20fe3afc395.tar.bz2
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. * ada-lang.c (ada_value_primitive_packed_val): Re-fetch type from value. (ada_template_to_fixed_record_type_1): Likewise. (ada_to_fixed_type_1): Likewise. * cp-valprint.c (cp_print_value_fields_rtti): Likewise. (cp_print_value): Likewise. * d-valprint.c (dynamic_array_type): Likewise. * eval.c (evaluate_subexp_with_coercion): Likewise. * findvar.c (address_of_variable): Likewise. * jv-valprint.c (java_value_print): Likewise. * valops.c (value_ind): Likewise. * value.c (coerce_ref): Likewise.
Diffstat (limited to 'gdb/valops.c')
-rw-r--r--gdb/valops.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gdb/valops.c b/gdb/valops.c
index 46e2639..a155379 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -266,6 +266,7 @@ value_cast_structs (struct type *type, struct value *v2)
{
v = value_full_object (v2, real_type, full, top, using_enc);
v = value_at_lazy (real_type, value_address (v));
+ real_type = value_type (v);
/* We might be trying to cast to the outermost enclosing
type, in which case search_struct_field won't work. */
@@ -801,6 +802,7 @@ value_dynamic_cast (struct type *type, struct value *arg)
return value_at_lazy (type, addr);
tem = value_at (type, addr);
+ type = value_type (tem);
/* The first dynamic check specified in 5.2.7. */
if (is_public_ancestor (arg_type, TYPE_TARGET_TYPE (resolved_type)))
@@ -1320,6 +1322,7 @@ address_of_variable (struct symbol *var, const struct block *b)
Lazy evaluation pays off here. */
val = value_of_variable (var, b);
+ type = value_type (val);
if ((VALUE_LVAL (val) == lval_memory && value_lazy (val))
|| TYPE_CODE (type) == TYPE_CODE_FUNC)
@@ -1568,6 +1571,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);
}