[Bug rust/24976] Segfault with one field unions in Rust

cvs-commit at gcc dot gnu.org sourceware-bugzilla@sourceware.org
Fri Oct 4 02:57:00 GMT 2019


--- Comment #1 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom Tromey <tromey@sourceware.org>:


commit 77c2dba3e843694fae090e237ccdf1b8f65b94e6
Author: Tom Tromey <tom@tromey.com>
Date:   Thu Oct 3 17:21:52 2019 -0600

    Avoid crash on single-field union in Rust

    PR rust/24976 points out a crash in gdb when a single-field union is
    used in Rust.

    The immediate problem was a NULL pointer dereference in
    quirk_rust_enum.  However, that code is also erroneously treating a
    single-field union as if it were a univariant enum.  Looking at the
    output of an older Rust compiler, it turns out that univariant enums
    are distinguished by having a single *anonymous* field.  This patch
    changes quirk_rust_enum to limit its fixup to this case.

    Tested with a new-enough version of the Rust compiler to cause the
    crash; plus by using an older executable that uses the old univariant

    2019-10-03  Tom Tromey  <tom@tromey.com>

        PR rust/24976:
        * dwarf2read.c (quirk_rust_enum): Handle single-element unions.

    2019-10-03  Tom Tromey  <tom@tromey.com>

        PR rust/24976:
        * gdb.rust/simple.rs (Union2): New type.
        (main): Use Union2.
        * gdb.rust/simple.exp: Add test.

You are receiving this mail because:
You are on the CC list for the bug.

More information about the Gdb-prs mailing list