public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-9505] dwarf2out: Fix -gsplit-dwarf on riscv [PR103874] Date: Mon, 24 Jan 2022 09:21:43 +0000 (GMT) [thread overview] Message-ID: <20220124092143.C49E43858425@sourceware.org> (raw) https://gcc.gnu.org/g:3991e4c752b3450decdb36e0b562e044ce653b3d commit r11-9505-g3991e4c752b3450decdb36e0b562e044ce653b3d Author: Jakub Jelinek <jakub@redhat.com> Date: Thu Jan 20 11:58:20 2022 +0100 dwarf2out: Fix -gsplit-dwarf on riscv [PR103874] riscv*-*-* are the only modern targets that !HAVE_AS_LEB128 (apparently due to some aggressive linker optimizations). As the following testcase shows, we mishandle in index_rnglists the !HAVE_AS_LEB128 && !have_multiple_function_sections case. output_rnglists does roughly: FOR_EACH_VEC_SAFE_ELT (ranges_table, i, r) { ... if (block_num > 0) { ... if (HAVE_AS_LEB128) { if (!have_multiple_function_sections) { // code not using r->*_entry continue; } // code that sometimes doesn't use r->*_entry, // sometimes r->begin_entry } else if (dwarf_split_debug_info) { // code that uses both r->begin_entry and r->end_entry } else { // code not using r->*_entry } } else if (block_num < 0) { if (!have_multiple_function_sections) gcc_unreachable (); ... } } and index_rnglists is what sets up those r->{begin,end}_entry members. The code did an early if (!have_multiple_function_sections) continue; which is fine for the HAVE_AS_LEB128 case, because r->*_entry is not used in that case, but not for !HAVE_AS_LEB128 that uses it anyway. 2022-01-20 Jakub Jelinek <jakub@redhat.com> PR debug/103874 * dwarf2out.c (index_rnglists): For !HAVE_AS_LEB128 and block_num > 0, index entry even if !have_multiple_function_sections. * gcc.dg/debug/dwarf2/pr103874.c: New test. (cherry picked from commit 68f03ac49cb4f585dbce78dc9e4c4a9ec950e83c) Diff: --- gcc/dwarf2out.c | 5 +++-- gcc/testsuite/gcc.dg/debug/dwarf2/pr103874.c | 12 ++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index d74c8e3867f..e5d3ce4966d 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -11961,9 +11961,10 @@ index_rnglists (void) if (r->label && r->idx != DW_RANGES_IDX_SKELETON) r->idx = rnglist_idx++; - if (!have_multiple_function_sections) - continue; int block_num = r->num; + if ((HAVE_AS_LEB128 || block_num < 0) + && !have_multiple_function_sections) + continue; if (HAVE_AS_LEB128 && (r->label || r->maybe_new_sec)) base = false; if (block_num > 0) diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr103874.c b/gcc/testsuite/gcc.dg/debug/dwarf2/pr103874.c new file mode 100644 index 00000000000..2f0e2d44e42 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr103874.c @@ -0,0 +1,12 @@ +/* PR debug/103874 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -g -gsplit-dwarf -dA -Wno-implicit-function-declaration" } */ + +void +foo (void) +{ + { + bar (); + baz (); + } +}
reply other threads:[~2022-01-24 9:21 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20220124092143.C49E43858425@sourceware.org \ --to=jakub@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.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).