Merge lp:~uweigand/gcc-linaro/lp-662324 into lp:gcc-linaro/4.5

Proposed by Ulrich Weigand
Status: Merged
Merged at revision: 99450
Proposed branch: lp:~uweigand/gcc-linaro/lp-662324
Merge into: lp:gcc-linaro/4.5
Diff against target: 111 lines (+83/-0)
4 files modified
ChangeLog.linaro (+16/-0)
gcc/dwarf2out.c (+10/-0)
gcc/testsuite/g++.dg/debug/dwarf2/self-ref-1.C (+28/-0)
gcc/testsuite/g++.dg/debug/dwarf2/self-ref-2.C (+29/-0)
To merge this branch: bzr merge lp:~uweigand/gcc-linaro/lp-662324
Reviewer Review Type Date Requested Status
Linaro Toolchain Developers Pending
Review via email: mp+44379@code.launchpad.net

Description of the change

Fix LP #662324 by backporting upstream fix for PR debug/45088.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ChangeLog.linaro'
2--- ChangeLog.linaro 2010-12-14 14:39:51 +0000
3+++ ChangeLog.linaro 2010-12-21 19:00:38 +0000
4@@ -1,3 +1,19 @@
5+2010-12-21 Ulrich Weigand <uweigand@de.ibm.com>
6+
7+ LP: #662324
8+ Backport from mainline:
9+
10+ 2010-12-17 Dodji Seketeli <dodji@redhat.com>
11+
12+ gcc/
13+ * dwarf2out.c (gen_type_die_with_usage): Do not try to emit debug
14+ info for a redundant typedef that has DECL_ORIGINAL_TYPE set. Use
15+ that underlying type instead.
16+
17+ gcc/testsuite/
18+ * g++.dg/debug/dwarf2/self-ref-1.C: New test.
19+ * g++.dg/debug/dwarf2/self-ref-2.C: Likewise.
20+
21 2010-12-14 Andrew Stubbs <ams@codesourcery.com>
22
23 gcc/
24
25=== modified file 'gcc/dwarf2out.c'
26--- gcc/dwarf2out.c 2010-10-04 00:50:43 +0000
27+++ gcc/dwarf2out.c 2010-12-21 19:00:38 +0000
28@@ -18993,6 +18993,16 @@
29 if (type == NULL_TREE || type == error_mark_node)
30 return;
31
32+ if (TYPE_NAME (type) != NULL_TREE
33+ && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
34+ && is_redundant_typedef (TYPE_NAME (type))
35+ && DECL_ORIGINAL_TYPE (TYPE_NAME (type)))
36+ /* The DECL of this type is a typedef we don't want to emit debug
37+ info for but we want debug info for its underlying typedef.
38+ This can happen for e.g, the injected-class-name of a C++
39+ type. */
40+ type = DECL_ORIGINAL_TYPE (TYPE_NAME (type));
41+
42 /* If TYPE is a typedef type variant, let's generate debug info
43 for the parent typedef which TYPE is a type of. */
44 if (TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
45
46=== added file 'gcc/testsuite/g++.dg/debug/dwarf2/self-ref-1.C'
47--- gcc/testsuite/g++.dg/debug/dwarf2/self-ref-1.C 1970-01-01 00:00:00 +0000
48+++ gcc/testsuite/g++.dg/debug/dwarf2/self-ref-1.C 2010-12-21 19:00:38 +0000
49@@ -0,0 +1,28 @@
50+// Origin: PR debug/45088
51+// { dg-do compile }
52+// { dg-options "-g -dA" }
53+// { dg-final { scan-assembler-times "\[^\n\r\]*\\(DIE\[^\n\r\]*DW_TAG_pointer_type\\)\[\n\r\]{1,2}\[^\n\r\]*DW_AT_byte_size\[\n\r\]{1,2}\[^\n\r\]*DW_AT_type" 4 } }
54+
55+struct A
56+{
57+ virtual ~A();
58+};
59+
60+struct B : public A
61+{
62+ virtual ~B(){}
63+};
64+
65+struct C : public B
66+{
67+ A* a1;
68+};
69+
70+int
71+main()
72+{
73+ C c;
74+ c.a1 = 0;
75+ return 0;
76+}
77+
78
79=== added file 'gcc/testsuite/g++.dg/debug/dwarf2/self-ref-2.C'
80--- gcc/testsuite/g++.dg/debug/dwarf2/self-ref-2.C 1970-01-01 00:00:00 +0000
81+++ gcc/testsuite/g++.dg/debug/dwarf2/self-ref-2.C 2010-12-21 19:00:38 +0000
82@@ -0,0 +1,29 @@
83+// Origin: PR debug/45088
84+// { dg-do compile }
85+// { dg-options "-g -dA" }
86+// { dg-final { scan-assembler-times "\[^\n\r\]*\\(DIE\[^\n\r\]*DW_TAG_pointer_type\\)\[\n\r\]{1,2}\[^\n\r\]*DW_AT_byte_size\[\n\r\]{1,2}\[^\n\r\]*DW_AT_type" 4 } }
87+
88+template<class T>
89+struct A
90+{
91+ virtual ~A();
92+};
93+
94+struct B : public A<int>
95+{
96+ virtual ~B(){}
97+};
98+
99+struct C : public B
100+{
101+ A<int>* a1;
102+};
103+
104+int
105+main()
106+{
107+ C c;
108+ c.a1 = 0;
109+ return 0;
110+}
111+

Subscribers

People subscribed via source and target branches