From 3754bbfc36b1650ab47e22446af664ecab5bbf2d Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Aug 2016 08:46:38 +0200 Subject: [PATCH] re PR c++/77363 (Missing debug information in DWARF) 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. From-SVN: r239855 --- gcc/ChangeLog | 5 +++++ gcc/dwarf2out.c | 3 ++- gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/g++.dg/debug/dwarf2/pr77363.C | 20 ++++++++++++++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/debug/dwarf2/pr77363.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 347c7c6a50d..3e394ccbcfe 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2016-08-30 Jakub Jelinek + 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. + PR middle-end/77377 * simplify-rtx.c (avoid_constant_pool_reference): For out of bounds constant pool reference return x instead of c. diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 45eb684e2a2..11e011399af 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -11474,7 +11474,8 @@ modified_type_die (tree type, int cv_quals, bool reverse, 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, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7a435819a68..4f6142aca6b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2016-08-30 Jakub Jelinek + PR debug/77363 + * g++.dg/debug/dwarf2/pr77363.C: New test. + PR middle-end/77377 * gcc.target/i386/pr77377.c: New test. diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/pr77363.C b/gcc/testsuite/g++.dg/debug/dwarf2/pr77363.C new file mode 100644 index 00000000000..47b71433815 --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/dwarf2/pr77363.C @@ -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; -- 2.30.2