aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2011-12-15 16:38:08 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2011-12-15 16:38:08 +0000
commitee7a54c550753ba90949d1fea472e0586b6cd954 (patch)
treec953b72b7d663af460cc1abd3269cf69ca79d5ae
parent6a2045bfd3938fe09a026f5d7ff041e28c94950e (diff)
downloadgcc-ee7a54c550753ba90949d1fea472e0586b6cd954.zip
gcc-ee7a54c550753ba90949d1fea472e0586b6cd954.tar.gz
gcc-ee7a54c550753ba90949d1fea472e0586b6cd954.tar.bz2
re PR debug/51567 (ICE in splice_child_die, at dwarf2out.c:5009 with -flto -g)
2011-12-15 Richard Guenther <rguenther@suse.de> PR lto/51567 * gimple.c (compare_type_names_p): Also compare the TREE_CODE. (iterative_hash_name): Also hash the TREE_CODE. (gimple_types_compatible_p_1): For types with a TYPE_DECL name and a type DECL_CONTEXT recurse to that type. (iterative_hash_gimple_type): Likewise. * g++.dg/lto/pr51567-1_0.C: New testcase. From-SVN: r182377
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/gimple.c34
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/lto/pr51567-1_0.C27
4 files changed, 73 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b6d8a02..966c5c8 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2011-12-15 Richard Guenther <rguenther@suse.de>
+
+ PR lto/51567
+ * gimple.c (compare_type_names_p): Also compare the TREE_CODE.
+ (iterative_hash_name): Also hash the TREE_CODE.
+ (gimple_types_compatible_p_1): For types with a TYPE_DECL
+ name and a type DECL_CONTEXT recurse to that type.
+ (iterative_hash_gimple_type): Likewise.
+
2011-12-15 Iain Sandoe <iains@gcc.gnu.org>
* config/rs6000/rs6000.c (rs6000_emit_prologue): Move update of
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 81c1190..3a90358 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -3318,11 +3318,21 @@ compare_type_names_p (tree t1, tree t2)
tree name1 = TYPE_NAME (t1);
tree name2 = TYPE_NAME (t2);
- if (name1 && TREE_CODE (name1) == TYPE_DECL)
+ if ((name1 != NULL_TREE) != (name2 != NULL_TREE))
+ return false;
+
+ if (name1 == NULL_TREE)
+ return true;
+
+ /* Either both should be a TYPE_DECL or both an IDENTIFIER_NODE. */
+ if (TREE_CODE (name1) != TREE_CODE (name2))
+ return false;
+
+ if (TREE_CODE (name1) == TYPE_DECL)
name1 = DECL_NAME (name1);
gcc_checking_assert (!name1 || TREE_CODE (name1) == IDENTIFIER_NODE);
- if (name2 && TREE_CODE (name2) == TYPE_DECL)
+ if (TREE_CODE (name2) == TYPE_DECL)
name2 = DECL_NAME (name2);
gcc_checking_assert (!name2 || TREE_CODE (name2) == IDENTIFIER_NODE);
@@ -3537,6 +3547,19 @@ gimple_types_compatible_p_1 (tree t1, tree t2, type_pair_t p,
if (!compare_type_names_p (t1, t2))
goto different_types;
+ /* We may not merge typedef types to the same type in different
+ contexts. */
+ if (TYPE_NAME (t1)
+ && TREE_CODE (TYPE_NAME (t1)) == TYPE_DECL
+ && DECL_CONTEXT (TYPE_NAME (t1))
+ && TYPE_P (DECL_CONTEXT (TYPE_NAME (t1))))
+ {
+ if (!gtc_visit (DECL_CONTEXT (TYPE_NAME (t1)),
+ DECL_CONTEXT (TYPE_NAME (t2)),
+ state, sccstack, sccstate, sccstate_obstack))
+ goto different_types;
+ }
+
/* If their attributes are not the same they can't be the same type. */
if (!attribute_list_equal (TYPE_ATTRIBUTES (t1), TYPE_ATTRIBUTES (t2)))
goto different_types;
@@ -3980,6 +4003,7 @@ iterative_hash_name (tree name, hashval_t v)
{
if (!name)
return v;
+ v = iterative_hash_hashval_t (TREE_CODE (name), v);
if (TREE_CODE (name) == TYPE_DECL)
name = DECL_NAME (name);
if (!name)
@@ -4046,6 +4070,12 @@ iterative_hash_gimple_type (tree type, hashval_t val,
only existing types having the same features as the new type will be
checked. */
v = iterative_hash_name (TYPE_NAME (type), 0);
+ if (TYPE_NAME (type)
+ && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
+ && DECL_CONTEXT (TYPE_NAME (type))
+ && TYPE_P (DECL_CONTEXT (TYPE_NAME (type))))
+ v = visit (DECL_CONTEXT (TYPE_NAME (type)), state, v,
+ sccstack, sccstate, sccstate_obstack);
v = iterative_hash_hashval_t (TREE_CODE (type), v);
v = iterative_hash_hashval_t (TYPE_QUALS (type), v);
v = iterative_hash_hashval_t (TREE_ADDRESSABLE (type), v);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 331ef1c..faac489 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2011-12-15 Richard Guenther <rguenther@suse.de>
+
+ PR lto/51567
+ * g++.dg/lto/pr51567-1_0.C: New testcase.
+
2011-12-15 Dodji Seketeli <dodji@redhat.com>
PR c++/51473
diff --git a/gcc/testsuite/g++.dg/lto/pr51567-1_0.C b/gcc/testsuite/g++.dg/lto/pr51567-1_0.C
new file mode 100644
index 0000000..87a7e97
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/pr51567-1_0.C
@@ -0,0 +1,27 @@
+// { dg-lto-do link }
+// { dg-lto-options { { -flto -g } } }
+
+struct _Deque_iterator {
+ int* _M_cur;
+ void foo() {}
+};
+class _Deque_base {
+public:
+ typedef _Deque_iterator iterator;
+ iterator _M_impl;
+};
+class deque : public _Deque_base {
+public:
+ typedef _Deque_base::iterator iterator;
+};
+class OutputContextStack {
+public:
+ deque m_stack;
+ deque::iterator m_stackPosition;
+};
+int main()
+{
+ OutputContextStack s;
+ s.m_stackPosition.foo();
+}
+