resolve_dynamic_struct says:
gdb_assert (type->num_fields () > 0);
However, a certain Ada program has a structure with no fields but with
a dynamic size, causing this assertion to fire.
It is difficult to be certain, but we think this is a compiler bug.
However, in the meantime this assertion does not seem to be checking
any kind of internal consistency; so this patch removes it.
gdb/ChangeLog
2021-02-09 Tom Tromey <tromey@adacore.com>
* gdbtypes.c (resolve_dynamic_struct): Handle structure with no
fields.
+2021-02-09 Tom Tromey <tromey@adacore.com>
+
+ * gdbtypes.c (resolve_dynamic_struct): Handle structure with no
+ fields.
+
2021-02-08 Shahab Vahedi <shahab@synopsys.com>
PR tdep/27369
unsigned resolved_type_bit_length = 0;
gdb_assert (type->code () == TYPE_CODE_STRUCT);
- gdb_assert (type->num_fields () > 0);
resolved_type = copy_type (type);
((struct field *)
TYPE_ALLOC (resolved_type,
resolved_type->num_fields () * sizeof (struct field)));
- memcpy (resolved_type->fields (),
- type->fields (),
- resolved_type->num_fields () * sizeof (struct field));
+ if (type->num_fields () > 0)
+ memcpy (resolved_type->fields (),
+ type->fields (),
+ resolved_type->num_fields () * sizeof (struct field));
}
for (i = 0; i < resolved_type->num_fields (); ++i)