From: Marek Polacek <polacek@redhat.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Cc: Jason Merrill <jason@redhat.com>
Subject: [PATCH] testsuite: fix dwarf2/utf-1.C with DWARF4
Date: Wed, 5 Jul 2023 17:51:51 -0400 [thread overview]
Message-ID: <20230705215151.84788-1-polacek@redhat.com> (raw)
Running
$ make check-c++ RUNTESTFLAGS='--target_board=unix\{-gdwarf-5,-gdwarf-4\} dwarf2.exp=utf-1.C'
shows
FAIL: g++.dg/debug/dwarf2/utf-1.C -std=gnu++20 scan-assembler-times DW_AT_encoding \\(0x10\\) 3
because with -gdwarf-4 the output is:
.byte 0x10 # DW_AT_encoding
but with -gdwarf-5 the output is the expected:
# DW_AT_encoding (0x10)
The difference is caused by the DWARF5 optimize_implicit_const
optimization:
<https://gcc.gnu.org/pipermail/gcc-patches/2016-October/459762.html>
I suppose we could do what testsuite/rust/debug/chartype.rs does
and just run the test with -gdwarf-4.
Tested on x86_64-pc-linux-gnu, ok for trunk?
gcc/testsuite/ChangeLog:
* g++.dg/debug/dwarf2/utf-1.C: Use -gdwarf-4. Adjust expected
output.
---
gcc/testsuite/g++.dg/debug/dwarf2/utf-1.C | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/utf-1.C b/gcc/testsuite/g++.dg/debug/dwarf2/utf-1.C
index 43b354f1bb5..0ce4d8727d6 100644
--- a/gcc/testsuite/g++.dg/debug/dwarf2/utf-1.C
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/utf-1.C
@@ -1,8 +1,13 @@
// { dg-do compile { target c++20 } }
-// { dg-options { -gdwarf -dA } }
+// { dg-options { -gdwarf-4 -dA } }
// Test that all three use DW_ATE_UTF.
-// { dg-final { scan-assembler-times {DW_AT_encoding \(0x10\)} 3 } }
+// This test uses -gdwarf-4 since in DWARF5 optimize_implicit_const
+// would optimize the output from:
+// .byte 0x10 # DW_AT_encoding
+// into:
+// # DW_AT_encoding (0x10)
+// { dg-final { scan-assembler-times "0x10\[ \t]\[^\n\r]* DW_AT_encoding" 3 } }
char8_t c8;
char16_t c16;
base-commit: be240fc6acc9714e66afbfbe6dc193844bfcba05
--
2.41.0
next reply other threads:[~2023-07-05 21:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-05 21:51 Marek Polacek [this message]
2023-07-18 16:54 ` Jason Merrill
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=20230705215151.84788-1-polacek@redhat.com \
--to=polacek@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jason@redhat.com \
/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: link
Be 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).