diff options
Diffstat (limited to 'gdb/ada-lang.c')
-rw-r--r-- | gdb/ada-lang.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 73de1a0a75..890e091d1b 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -556,17 +556,19 @@ coerce_unspec_val_to_type (struct value *val, struct type *type) trying to allocate some memory for it. */ check_size (type); - result = allocate_value (type); + if (value_lazy (val) + || TYPE_LENGTH (type) > TYPE_LENGTH (value_type (val))) + result = allocate_value_lazy (type); + else + { + result = allocate_value (type); + memcpy (value_contents_raw (result), value_contents (val), + TYPE_LENGTH (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_lazy (val) - || TYPE_LENGTH (type) > TYPE_LENGTH (value_type (val))) - set_value_lazy (result, 1); - else - memcpy (value_contents_raw (result), value_contents (val), - TYPE_LENGTH (type)); return result; } } |