public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix dwarf2out ARRAY_TYPE handling (PR debug/77363)
@ 2016-08-29 19:53 Jakub Jelinek
  2016-08-30  4:45 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2016-08-29 19:53 UTC (permalink / raw)
  To: Jason Merrill, Richard Biener; +Cc: gcc-patches

Hi!

In r231058 gen_type_die_with_usage has been changed to treat ARRAY_TYPE like
VECTOR_TYPE and not to use type_main_variant in that case.  But as the
following testcase shows, modified_type_die has similar condition and if
those two don't agree, modified_type_die just fails the lookup if
type_main_variant (type) != type, and we then fail to add DW_AT_type to
the DW_TAG_typedef because of that.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk/6.2/5.5?

2016-08-29  Jakub Jelinek  <jakub@redhat.com>

	PR debug/77363
	* dwarf2out.c (modified_type_die): Use lookup_type_die (type)
	instead of lookup_type_die (type_main_variant (type)) even for array
	types.

	* g++.dg/debug/dwarf2/pr77363.C: New test.

--- gcc/dwarf2out.c.jj	2016-08-29 12:35:49.000000000 +0200
+++ gcc/dwarf2out.c	2016-08-29 18:05:42.171597789 +0200
@@ -11474,7 +11474,8 @@ modified_type_die (tree type, int cv_qua
 	 copy was created to help us keep track of typedef names) and
 	 that copy might have a different TYPE_UID from the original
 	 ..._TYPE node.  */
-      if (TREE_CODE (type) != VECTOR_TYPE)
+      if (TREE_CODE (type) != VECTOR_TYPE
+	  && TREE_CODE (type) != ARRAY_TYPE)
 	return lookup_type_die (type_main_variant (type));
       else
 	/* Vectors have the debugging information in the type,
--- gcc/testsuite/g++.dg/debug/dwarf2/pr77363.C.jj	2016-08-29 18:26:09.218310766 +0200
+++ gcc/testsuite/g++.dg/debug/dwarf2/pr77363.C	2016-08-29 18:30:03.232579332 +0200
@@ -0,0 +1,20 @@
+// PR debug/77363
+// { dg-options "-gdwarf-2 -dA -fno-merge-debug-strings" }
+// { dg-final { scan-assembler "DIE \\(\[^\n\r\]*\\) DW_TAG_typedef\[^\n\r\]*\[\n\r]*\[^\n\r\]*type2\[^\n\r\]* DW_AT_name\[^\n\r\]*\[\n\r]*\[^\n\r\]* DW_AT_decl_file\[^\n\r\]*\[\n\r]*\[^\n\r\]* DW_AT_decl_line\[^\n\r\]*\[\n\r]*\[^\n\r\]* DW_AT_type" } }
+// { dg-final { scan-assembler "DIE \\(\[^\n\r\]*\\) DW_TAG_typedef\[^\n\r\]*\[\n\r]*\[^\n\r\]*type3\[^\n\r\]* DW_AT_name\[^\n\r\]*\[\n\r]*\[^\n\r\]* DW_AT_decl_file\[^\n\r\]*\[\n\r]*\[^\n\r\]* DW_AT_decl_line\[^\n\r\]*\[\n\r]*\[^\n\r\]* DW_AT_type" } }
+// { dg-final { scan-assembler "DIE \\(\[^\n\r\]*\\) DW_TAG_typedef\[^\n\r\]*\[\n\r]*\[^\n\r\]*type4\[^\n\r\]* DW_AT_name\[^\n\r\]*\[\n\r]*\[^\n\r\]* DW_AT_decl_file\[^\n\r\]*\[\n\r]*\[^\n\r\]* DW_AT_decl_line\[^\n\r\]*\[\n\r]*\[^\n\r\]* DW_AT_type" } }
+// { dg-final { scan-assembler "DIE \\(\[^\n\r\]*\\) DW_TAG_typedef\[^\n\r\]*\[\n\r]*\[^\n\r\]*type5\[^\n\r\]* DW_AT_name\[^\n\r\]*\[\n\r]*\[^\n\r\]* DW_AT_decl_file\[^\n\r\]*\[\n\r]*\[^\n\r\]* DW_AT_decl_line\[^\n\r\]*\[\n\r]*\[^\n\r\]* DW_AT_type" } }
+
+typedef unsigned short type1;
+typedef unsigned char type2;
+typedef type2 type3[16];
+typedef unsigned char type4[16];
+typedef struct
+{
+  struct
+  {
+    type3 a;
+    type4 b;
+  } c;
+} type5;
+type5 var;

	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix dwarf2out ARRAY_TYPE handling (PR debug/77363)
  2016-08-29 19:53 [PATCH] Fix dwarf2out ARRAY_TYPE handling (PR debug/77363) Jakub Jelinek
@ 2016-08-30  4:45 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2016-08-30  4:45 UTC (permalink / raw)
  To: Jakub Jelinek, Jason Merrill; +Cc: gcc-patches

On August 29, 2016 9:53:32 PM GMT+02:00, Jakub Jelinek <jakub@redhat.com> wrote:
>Hi!
>
>In r231058 gen_type_die_with_usage has been changed to treat ARRAY_TYPE
>like
>VECTOR_TYPE and not to use type_main_variant in that case.  But as the
>following testcase shows, modified_type_die has similar condition and
>if
>those two don't agree, modified_type_die just fails the lookup if
>type_main_variant (type) != type, and we then fail to add DW_AT_type to
>the DW_TAG_typedef because of that.
>
>Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok
>for
>trunk/6.2/5.5?

OK.

Thanks,
Richard.

>2016-08-29  Jakub Jelinek  <jakub@redhat.com>
>
>	PR debug/77363
>	* dwarf2out.c (modified_type_die): Use lookup_type_die (type)
>	instead of lookup_type_die (type_main_variant (type)) even for array
>	types.
>
>	* g++.dg/debug/dwarf2/pr77363.C: New test.
>
>--- gcc/dwarf2out.c.jj	2016-08-29 12:35:49.000000000 +0200
>+++ gcc/dwarf2out.c	2016-08-29 18:05:42.171597789 +0200
>@@ -11474,7 +11474,8 @@ modified_type_die (tree type, int cv_qua
> 	 copy was created to help us keep track of typedef names) and
> 	 that copy might have a different TYPE_UID from the original
> 	 ..._TYPE node.  */
>-      if (TREE_CODE (type) != VECTOR_TYPE)
>+      if (TREE_CODE (type) != VECTOR_TYPE
>+	  && TREE_CODE (type) != ARRAY_TYPE)
> 	return lookup_type_die (type_main_variant (type));
>       else
> 	/* Vectors have the debugging information in the type,
>--- gcc/testsuite/g++.dg/debug/dwarf2/pr77363.C.jj	2016-08-29
>18:26:09.218310766 +0200
>+++ gcc/testsuite/g++.dg/debug/dwarf2/pr77363.C	2016-08-29
>18:30:03.232579332 +0200
>@@ -0,0 +1,20 @@
>+// PR debug/77363
>+// { dg-options "-gdwarf-2 -dA -fno-merge-debug-strings" }
>+// { dg-final { scan-assembler "DIE \\(\[^\n\r\]*\\)
>DW_TAG_typedef\[^\n\r\]*\[\n\r]*\[^\n\r\]*type2\[^\n\r\]*
>DW_AT_name\[^\n\r\]*\[\n\r]*\[^\n\r\]*
>DW_AT_decl_file\[^\n\r\]*\[\n\r]*\[^\n\r\]*
>DW_AT_decl_line\[^\n\r\]*\[\n\r]*\[^\n\r\]* DW_AT_type" } }
>+// { dg-final { scan-assembler "DIE \\(\[^\n\r\]*\\)
>DW_TAG_typedef\[^\n\r\]*\[\n\r]*\[^\n\r\]*type3\[^\n\r\]*
>DW_AT_name\[^\n\r\]*\[\n\r]*\[^\n\r\]*
>DW_AT_decl_file\[^\n\r\]*\[\n\r]*\[^\n\r\]*
>DW_AT_decl_line\[^\n\r\]*\[\n\r]*\[^\n\r\]* DW_AT_type" } }
>+// { dg-final { scan-assembler "DIE \\(\[^\n\r\]*\\)
>DW_TAG_typedef\[^\n\r\]*\[\n\r]*\[^\n\r\]*type4\[^\n\r\]*
>DW_AT_name\[^\n\r\]*\[\n\r]*\[^\n\r\]*
>DW_AT_decl_file\[^\n\r\]*\[\n\r]*\[^\n\r\]*
>DW_AT_decl_line\[^\n\r\]*\[\n\r]*\[^\n\r\]* DW_AT_type" } }
>+// { dg-final { scan-assembler "DIE \\(\[^\n\r\]*\\)
>DW_TAG_typedef\[^\n\r\]*\[\n\r]*\[^\n\r\]*type5\[^\n\r\]*
>DW_AT_name\[^\n\r\]*\[\n\r]*\[^\n\r\]*
>DW_AT_decl_file\[^\n\r\]*\[\n\r]*\[^\n\r\]*
>DW_AT_decl_line\[^\n\r\]*\[\n\r]*\[^\n\r\]* DW_AT_type" } }
>+
>+typedef unsigned short type1;
>+typedef unsigned char type2;
>+typedef type2 type3[16];
>+typedef unsigned char type4[16];
>+typedef struct
>+{
>+  struct
>+  {
>+    type3 a;
>+    type4 b;
>+  } c;
>+} type5;
>+type5 var;
>
>	Jakub


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-08-30  4:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-29 19:53 [PATCH] Fix dwarf2out ARRAY_TYPE handling (PR debug/77363) Jakub Jelinek
2016-08-30  4:45 ` Richard Biener

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).