Index: ada-lang.c =================================================================== RCS file: /cvs/src/src/gdb/ada-lang.c,v retrieving revision 1.187 diff -u -p -r1.187 ada-lang.c --- ada-lang.c 13 Jan 2009 10:34:30 -0000 1.187 +++ ada-lang.c 4 Feb 2009 16:08:15 -0000 @@ -6877,7 +6877,15 @@ ada_template_to_fixed_record_type_1 (str 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;