From: Tom Tromey Date: Tue, 30 Jun 2020 13:57:35 +0000 (-0600) Subject: Fix bug in quirk_rust_enum X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a1520ad8fc5c5c1932d69e4685836cc1375bd850;p=binutils-gdb.git Fix bug in quirk_rust_enum Tom de Vries pointed out that some Rust tests were failing after the variant part rewrite. He sent an executable, which helped track down this bug. quirk_rust_enum was passing 1 to alloc_rust_variant in one case. However, a comment earlier says: /* We don't need a range entry for the discriminant, but we do need one for every other field, as there is no default variant. */ In this case, we must pass -1 for this parameter. That is what this patch implements. gdb/ChangeLog 2020-06-30 Tom Tromey * dwarf2/read.c (quirk_rust_enum): Correctly call alloc_rust_variant for default-less enum. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ddd831e7311..d64f572e071 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2020-06-30 Tom Tromey + + * dwarf2/read.c (quirk_rust_enum): Correctly call + alloc_rust_variant for default-less enum. + 2020-06-30 Tom Tromey PR build/26183: diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 4dc9ad6c99b..b097f624b6c 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -9691,7 +9691,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile) } /* Indicate that this is a variant type. */ - alloc_rust_variant (&objfile->objfile_obstack, type, 0, 1, + alloc_rust_variant (&objfile->objfile_obstack, type, 0, -1, gdb::array_view (ranges, n_fields - 1)); }