]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
debug/100530 - Revert QUAL_ADDR_SPACE handling from dwarf2out.cc
authorRichard Biener <rguenther@suse.de>
Fri, 31 Jan 2025 07:56:39 +0000 (08:56 +0100)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 31 Jan 2025 10:50:59 +0000 (11:50 +0100)
The bug clearly shows that r8-4385-ga297ccb52e0c89 was wrong in
enabling handling of address-space qualification as DWARF type
qualifiers as the code isn't prepared to it actually be not handled
and ends up changing a lesser qualified (without address-space)
type DIE in ways tripping asserts.  The following reverts that
part which then causes the DIE for the same type with address-space
qualifiers removed to be re-used since there's currently no code
to encode address-spaces within dwarf2out.cc or in the DWARF spec.

r8-4385-ga297ccb52e0c89 did not come with a testcase nor a good
description of the bug fixed - I've verified const qualification
mixed with address-spaces creates the expected DWARF.

PR debug/100530
* dwarf2out.cc (modified_type_die): Do not claim we handle
address-space qualification with dwarf_qual_info[].

* gcc.target/i386/pr100530.c: New testcase.

gcc/dwarf2out.cc
gcc/testsuite/gcc.target/i386/pr100530.c [new file with mode: 0644]

index 8085b8d85d8981ed0ec718a5da9125d057758809..43884f206c07facf980495c3b5e01a37bdbf33bf 100644 (file)
@@ -13678,8 +13678,7 @@ modified_type_die (tree type, int cv_quals, bool reverse,
   struct array_descr_info info;
   /* Only these cv-qualifiers are currently handled.  */
   const int cv_qual_mask = (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE
-                           | TYPE_QUAL_RESTRICT | TYPE_QUAL_ATOMIC |
-                           ENCODE_QUAL_ADDR_SPACE(~0U));
+                           | TYPE_QUAL_RESTRICT | TYPE_QUAL_ATOMIC);
   /* DW_AT_endianity is specified only for base types in the standard.  */
   const bool reverse_type
     = need_endianity_attribute_p (reverse)
diff --git a/gcc/testsuite/gcc.target/i386/pr100530.c b/gcc/testsuite/gcc.target/i386/pr100530.c
new file mode 100644 (file)
index 0000000..005c019
--- /dev/null
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "-g" } */
+
+__seg_gs const int var;
+__seg_gs int foo;