Hi!

Some time ago I've changed modified_type_die, so that it doesn't emit
the internal "sizetype" type as DW_TAG_base_type, but instead emits the
underlying type (e.g. "long unsigned int" or whatever the target has).
This PR complains that when .debug_pubtypes is emitted, we still refer to it
through "sizetype" name, and the "sizetype" .debug_pubtypes entry points to
a DW_TAG_base_type with "long unsigned int" name (or similar).

The following patch makes sure it doesn't appear even in .debug_pubtypes.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2019-01-03  Jakub Jelinek  <ja...@redhat.com>

        PR debug/88644
        * dwarf2out.c (modified_type_die): If type is equal to sizetype,
        change it to qualified_type.

        * gcc.dg/debug/dwarf2/pr88644.c: New test.
        * gcc.dg/debug/dwarf2/pr80263.c: Remove darwin hack.

2019-01-03  Iain Sandoe  <i...@sandoe.co.uk>

        * gcc.dg/pubtypes-2.c: Adjust expected pubtypes length.
        * gcc.dg/pubtypes-3.c: Likewise.
        * gcc.dg/pubtypes-4.c: Likewise.

--- gcc/dwarf2out.c.jj  2019-01-01 12:37:16.113992080 +0100
+++ gcc/dwarf2out.c     2019-01-02 20:07:48.591193291 +0100
@@ -13152,6 +13152,8 @@ modified_type_die (tree type, int cv_qua
               && TYPE_PRECISION (sizetype) == TYPE_PRECISION (size_type_node)
               && TYPE_UNSIGNED (sizetype) == TYPE_UNSIGNED (size_type_node))
        qualified_type = size_type_node;
+      if (type == sizetype)
+       type = qualified_type;
     }
 
   /* If we do, then we can just use its DIE, if it exists.  */
--- gcc/testsuite/gcc.dg/debug/dwarf2/pr88644.c.jj      2019-01-02 
20:12:53.284261470 +0100
+++ gcc/testsuite/gcc.dg/debug/dwarf2/pr88644.c 2019-01-02 20:13:24.238760419 
+0100
@@ -0,0 +1,7 @@
+/* PR debug/88644 */
+/* { dg-do compile } */
+/* { dg-options "-gdwarf-4 -dA -gpubnames" } */
+
+char array[1];
+
+/* { dg-final { scan-assembler-not {\msizetype} } } */
--- gcc/testsuite/gcc.dg/debug/dwarf2/pr80263.c.jj      2018-08-26 
22:41:31.095644328 +0200
+++ gcc/testsuite/gcc.dg/debug/dwarf2/pr80263.c 2019-01-02 20:13:03.779091593 
+0100
@@ -1,8 +1,6 @@
 /* PR debug/80263 */
 /* { dg-do compile } */
 /* { dg-options "-g -dA" } */
-/* Darwin emits pubnames/types by default - suppress this for the test. */
-/* { dg-additional-options "-gno-pubnames" { target *-*-darwin* } }  */
 
 char array[1];
 
--- gcc/testsuite/gcc.dg/pubtypes-2.c.jj        2017-06-19 10:39:09.583276388 
+0200
+++ gcc/testsuite/gcc.dg/pubtypes-2.c   2019-01-02 22:05:30.933780939 +0100
@@ -2,7 +2,7 @@
 /* { dg-options "-O0 -gdwarf-2 -dA" } */
 /* { dg-skip-if "Unmatchable assembly" { mmix-*-* } } */
 /* { dg-final { scan-assembler "__debug_pubtypes" } } */
-/* { dg-final { scan-assembler "long+\[ \t\]+0x13b+\[ \t\]+\[#;]+\[ \t\]+Pub 
Info Length" } } */
+/* { dg-final { scan-assembler "long+\[ \t\]+0x12e+\[ \t\]+\[#;]+\[ \t\]+Pub 
Info Length" } } */
 /* { dg-final { scan-assembler "used_struct\\\\0\"+\[ \t\]+\[#;]+\[ 
\t\]+external name" } } */
 /* { dg-final { scan-assembler-not "unused_struct\\\\0\"+\[ \t\]+\[#;]+\[ 
\t\]+external name" } } */
 
--- gcc/testsuite/gcc.dg/pubtypes-3.c.jj        2017-06-19 10:39:09.725274700 
+0200
+++ gcc/testsuite/gcc.dg/pubtypes-3.c   2019-01-02 22:03:53.044367518 +0100
@@ -2,7 +2,7 @@
 /* { dg-options "-O0 -gdwarf-2 -dA" } */
 /* { dg-skip-if "Unmatchable assembly" { mmix-*-* } } */
 /* { dg-final { scan-assembler "__debug_pubtypes" } } */
-/* { dg-final { scan-assembler "long+\[ \t\]+0x13b+\[ \t\]+\[#;]+\[ \t\]+Pub 
Info Length" } } */
+/* { dg-final { scan-assembler "long+\[ \t\]+0x12e+\[ \t\]+\[#;]+\[ \t\]+Pub 
Info Length" } } */
 /* { dg-final { scan-assembler "used_struct\\\\0\"+\[ \t\]+\[#;]+\[ 
\t\]+external name" } } */
 /* { dg-final { scan-assembler-not "unused_struct\\\\0\"+\[ \t\]+\[#;]+\[ 
\t\]+external name" } } */
 /* { dg-final { scan-assembler-not "\"list_name_type\\\\0\"+\[ \t\]+\[#;]+\[ 
\t\]+external name" } } */
--- gcc/testsuite/gcc.dg/pubtypes-4.c.jj        2017-06-19 10:39:09.434278158 
+0200
+++ gcc/testsuite/gcc.dg/pubtypes-4.c   2019-01-02 22:03:53.044367518 +0100
@@ -2,7 +2,7 @@
 /* { dg-options "-O0 -gdwarf-2 -dA" } */
 /* { dg-skip-if "Unmatchable assembly" { mmix-*-* } } */
 /* { dg-final { scan-assembler "__debug_pubtypes" } } */
-/* { dg-final { scan-assembler "long+\[ \t\]+0x172+\[ \t\]+\[#;]+\[ \t\]+Pub 
Info Length" } } */
+/* { dg-final { scan-assembler "long+\[ \t\]+0x165+\[ \t\]+\[#;]+\[ \t\]+Pub 
Info Length" } } */
 /* { dg-final { scan-assembler "used_struct\\\\0\"+\[ \t\]+\[#;]+\[ 
\t\]+external name" } } */
 /* { dg-final { scan-assembler-not "unused_struct\\\\0\"+\[ \t\]+\[#;]+\[ 
\t\]+external name" } } */
 /* { dg-final { scan-assembler "\"list_name_type\\\\0\"+\[ \t\]+\[#;]+\[ 
\t\]+external name" } } */

        Jakub

Reply via email to