diff options
Diffstat (limited to 'gdb/ada-lang.c')
-rw-r--r-- | gdb/ada-lang.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 656e771..2552bff 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -6877,7 +6877,15 @@ ada_template_to_fixed_record_type_1 (struct type *type, else if (is_dynamic_field (type, f)) { if (dval0 == NULL) - dval = value_from_contents_and_address (rtype, valaddr, address); + { + /* rtype's length is computed based on the run-time + value of discriminants. If the discriminants are not + initialized, the type size may be completely bogus and + GDB may fail to allocate a value for it. So check the + size first before creating the value. */ + check_size (rtype); + dval = value_from_contents_and_address (rtype, valaddr, address); + } else dval = dval0; |