public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "jakub at redhat dot com" <sourceware-bugzilla@sourceware.org> To: gdb-prs@sourceware.org Subject: [Bug gdb/30651] New: GDB crash on _BitInt debuginfo Date: Tue, 18 Jul 2023 17:33:20 +0000 [thread overview] Message-ID: <bug-30651-4717@http.sourceware.org/bugzilla/> (raw) https://sourceware.org/bugzilla/show_bug.cgi?id=30651 Bug ID: 30651 Summary: GDB crash on _BitInt debuginfo Product: gdb Version: 12.1 Status: NEW Severity: normal Priority: P2 Component: gdb Assignee: unassigned at sourceware dot org Reporter: jakub at redhat dot com Target Milestone: --- Created attachment 14984 --> https://sourceware.org/bugzilla/attachment.cgi?id=14984&action=edit bitint-39a.s gdb 12.1 (haven't tried more recent) crashes with ../../gdb/dwarf2/attribute.h:90: internal-error: as_unsigned: Assertion `form_is_unsigned ()' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. when trying to debug following testcase: int v; __attribute__((noinline, noclone)) void bar (void) { v++; } __attribute__((noinline, noclone)) signed _BitInt (19) t111_1mul (unsigned _BitInt (19) x, signed _BitInt (19) y) { signed _BitInt (19) r; if (__builtin_mul_overflow (x, y, &r)) bar (); return r; } __attribute__((noinline, noclone)) signed _BitInt (19) t111_2mul (signed _BitInt (19) y) { unsigned _BitInt (19) x = (2); signed _BitInt (19) r; if (__builtin_mul_overflow (x, y, &r)) bar (); return r; } __attribute__((noinline, noclone)) signed _BitInt (19) t111_3mul (signed _BitInt (19) y) { signed _BitInt (19) r; if (__builtin_mul_overflow ((unsigned _BitInt (19)) (2), y, &r)) bar (); return r; } __attribute__((noinline, noclone)) signed _BitInt (19) t111_4mul (unsigned _BitInt (19) x) { signed _BitInt (19) y = (-262143wb - 1 / 2); signed _BitInt (19) r; if (__builtin_mul_overflow (x, y, &r)) bar (); return r; } __attribute__((noinline, noclone)) signed _BitInt (19) t111_5mul (unsigned _BitInt (19) x) { signed _BitInt (19) r; if (__builtin_mul_overflow (x, (signed _BitInt (19)) (-262143wb - 1 / 2), &r)) bar (); return r; } __attribute__((noinline, noclone)) void t111mul (void) { unsigned _BitInt (19) x = (2); signed _BitInt (19) y = (-262143wb - 1 / 2); signed _BitInt (19) r1, r2; v = 0; if (t111_1mul (x, y) != (signed _BitInt (19)) (-262143wb - 1) || t111_2mul (y) != (signed _BitInt (19)) (-262143wb - 1) || t111_3mul (y) != (signed _BitInt (19)) (-262143wb - 1) || t111_4mul (x) != (signed _BitInt (19)) (-262143wb - 1) || t111_5mul (x) != (signed _BitInt (19)) (-262143wb - 1)) __builtin_abort (); if (__builtin_mul_overflow (x, y, &r1)) bar (); if (r1 != (signed _BitInt (19)) (-262143wb - 1)) __builtin_abort (); if (__builtin_mul_overflow ((unsigned _BitInt (19)) (2), (signed _BitInt (19)) (-262143wb - 1 / 2), &r2)) bar (); if (r2 != (signed _BitInt (19)) (-262143wb - 1) || v != 7 * 0) __builtin_abort (); } int main () { t111mul (); return 0; } with GCC trunk patched with https://gcc.gnu.org/bugzilla/attachment.cgi?id=55572&action=diff compiled with -g -std=gnu2x. The DW_TAG_base_type for _BitInt uses .byte 0x4 # uleb128 0x4; (abbrev code) .byte 0x24 # uleb128 0x24; (TAG: DW_TAG_base_type) .byte 0 # DW_children_no .byte 0xb # uleb128 0xb; (DW_AT_byte_size) .byte 0x21 # uleb128 0x21; (DW_FORM_implicit_const) .byte 0x4 # sleb128 4 .byte 0x3e # uleb128 0x3e; (DW_AT_encoding) .byte 0xb # uleb128 0xb; (DW_FORM_data1) .byte 0xd # uleb128 0xd; (DW_AT_bit_size) .byte 0x21 # uleb128 0x21; (DW_FORM_implicit_const) .byte 0x13 # sleb128 19 .byte 0x3 # uleb128 0x3; (DW_AT_name) .byte 0xe # uleb128 0xe; (DW_FORM_strp) .byte 0 .byte 0 but I don't see anything wrong on that, DW_FORM_implicit_const always uses sleb128 encoding of the constant and all that matters is whether that constant is signed or unsigned, not that it uses sleb128 encoding. The crash is after run up -- You are receiving this mail because: You are on the CC list for the bug.
next reply other threads:[~2023-07-18 17:33 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-07-18 17:33 jakub at redhat dot com [this message] 2023-07-18 17:33 ` [Bug gdb/30651] " jakub at redhat dot com 2023-07-18 21:35 ` tromey at sourceware dot org 2023-07-20 21:31 ` tromey at sourceware dot org 2023-07-20 21:57 ` jakub at redhat dot com 2023-07-20 22:11 ` tromey at sourceware dot org 2023-07-20 22:12 ` tromey at sourceware dot org 2023-07-21 20:20 ` cvs-commit at gcc dot gnu.org 2023-07-21 20:21 ` tromey at sourceware dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-30651-4717@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=gdb-prs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).