Conditionally drop the discriminant field in quirk_rust_enum
authorTom Tromey <tom@tromey.com>
Thu, 12 Apr 2018 14:05:16 +0000 (08:05 -0600)
committerTom Tromey <tom@tromey.com>
Tue, 17 Apr 2018 19:37:44 +0000 (13:37 -0600)
commitbedda9aced2b3a8ab05e0fbf1372e394e32afbde
tree8a9451b501969cac27636c36c1ce60b3c7cce4f6
parenta037790ec570ae9f9bf535cbce25f238f90e8b4a
Conditionally drop the discriminant field in quirk_rust_enum

While debugging the crash that Jan reported, I noticed that in some
situations we could end up with a situation where one branch of a Rust
enum type ended up with a field count of -1.

The fix is simple: only conditionally drop the discriminant field when
rewriting the enum variants.

I couldn't find a way to test this; I only noticed it while debugging
the DWARF reader.

2018-04-17  Tom Tromey  <tom@tromey.com>

* dwarf2read.c (quirk_rust_enum): Conditionally drop the
discriminant field.
gdb/ChangeLog
gdb/dwarf2read.c