dwarf2read.c (update_enumeration_type_from_children): Avoid infinite loop.

gdb/ChangeLog:

	* dwarf2read.c (update_enumeration_type_from_children): Avoid
	infinite loop.
This commit is contained in:
Doug Evans 2014-11-13 15:43:12 -08:00
parent 57494d81b6
commit 60f7655a4a
2 changed files with 10 additions and 3 deletions

View file

@ -1,3 +1,8 @@
2014-11-13 Doug Evans <dje@google.com>
* dwarf2read.c (update_enumeration_type_from_children): Avoid
infinite loop.
2014-11-13 Jan Kratochvil <jan.kratochvil@redhat.com>
* NEWS (maint set target-async): Fix typo.

View file

@ -13231,7 +13231,7 @@ update_enumeration_type_from_children (struct die_info *die,
struct dwarf2_cu *cu)
{
struct obstack obstack;
struct die_info *child_die = die->child;
struct die_info *child_die;
int unsigned_enum = 1;
int flag_enum = 1;
ULONGEST mask = 0;
@ -13240,13 +13240,16 @@ update_enumeration_type_from_children (struct die_info *die,
obstack_init (&obstack);
old_chain = make_cleanup_obstack_free (&obstack);
while (child_die != NULL && child_die->tag)
for (child_die = die->child;
child_die != NULL && child_die->tag;
child_die = sibling_die (child_die))
{
struct attribute *attr;
LONGEST value;
const gdb_byte *bytes;
struct dwarf2_locexpr_baton *baton;
const char *name;
if (child_die->tag != DW_TAG_enumerator)
continue;
@ -13274,7 +13277,6 @@ update_enumeration_type_from_children (struct die_info *die,
a flag type, no need to look at the rest of the enumerates. */
if (!unsigned_enum && !flag_enum)
break;
child_die = sibling_die (child_die);
}
if (unsigned_enum)