aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2011-05-26 15:53:23 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2011-05-26 15:53:23 +0000
commitd74be3171290547f3311f959351e0c3afe7dcd21 (patch)
treec8a50e2aa082687b2d4e7d0169e2b0849e91c113
parentd3677132a22eb57336e8a749a19f346ac46cdca8 (diff)
downloadgcc-d74be3171290547f3311f959351e0c3afe7dcd21.zip
gcc-d74be3171290547f3311f959351e0c3afe7dcd21.tar.gz
gcc-d74be3171290547f3311f959351e0c3afe7dcd21.tar.bz2
lto.c (uniquify_nodes): Fix bug in one of the previous changes.
2011-05-26 Richard Guenther <rguenther@suse.de> lto/ * lto.c (uniquify_nodes): Fix bug in one of the previous changes. From-SVN: r174296
-rw-r--r--gcc/lto/ChangeLog4
-rw-r--r--gcc/lto/lto.c55
2 files changed, 33 insertions, 26 deletions
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index aa8859c..9412f76 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -1,3 +1,7 @@
+2011-05-26 Richard Guenther <rguenther@suse.de>
+
+ * lto.c (uniquify_nodes): Fix bug in one of the previous changes.
+
2011-05-25 Nathan Froyd <froydnj@codesourcery.com>
* lto.c (lto_ft_typed): New function.
diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c
index 1067b51..9d4e2ed 100644
--- a/gcc/lto/lto.c
+++ b/gcc/lto/lto.c
@@ -610,33 +610,36 @@ uniquify_nodes (struct data_in *data_in, unsigned from)
}
}
- else if (RECORD_OR_UNION_TYPE_P (t))
+ else
{
- tree f1, f2;
- if (TYPE_FIELDS (t) != TYPE_FIELDS (oldt))
- for (f1 = TYPE_FIELDS (t), f2 = TYPE_FIELDS (oldt);
- f1 && f2; f1 = TREE_CHAIN (f1), f2 = TREE_CHAIN (f2))
- {
- unsigned ix;
- gcc_assert (f1 != f2 && DECL_NAME (f1) == DECL_NAME (f2));
- if (!lto_streamer_cache_lookup (cache, f2, &ix))
- gcc_unreachable ();
- /* If we're going to replace an element which we'd
- still visit in the next iterations, we wouldn't
- handle it, so do it here. We do have to handle it
- even though the field_decl itself will be removed,
- as it could refer to e.g. integer_cst which we
- wouldn't reach via any other way, hence they
- (and their type) would stay uncollected. */
- /* ??? We should rather make sure to replace all
- references to f2 with f1. That means handling
- COMPONENT_REFs and CONSTRUCTOR elements in
- lto_fixup_types and special-case the field-decl
- operand handling. */
- if (ix < i)
- lto_fixup_types (f2);
- lto_streamer_cache_insert_at (cache, f1, ix);
- }
+ if (RECORD_OR_UNION_TYPE_P (t))
+ {
+ tree f1, f2;
+ if (TYPE_FIELDS (t) != TYPE_FIELDS (oldt))
+ for (f1 = TYPE_FIELDS (t), f2 = TYPE_FIELDS (oldt);
+ f1 && f2; f1 = TREE_CHAIN (f1), f2 = TREE_CHAIN (f2))
+ {
+ unsigned ix;
+ gcc_assert (f1 != f2 && DECL_NAME (f1) == DECL_NAME (f2));
+ if (!lto_streamer_cache_lookup (cache, f2, &ix))
+ gcc_unreachable ();
+ /* If we're going to replace an element which we'd
+ still visit in the next iterations, we wouldn't
+ handle it, so do it here. We do have to handle it
+ even though the field_decl itself will be removed,
+ as it could refer to e.g. integer_cst which we
+ wouldn't reach via any other way, hence they
+ (and their type) would stay uncollected. */
+ /* ??? We should rather make sure to replace all
+ references to f2 with f1. That means handling
+ COMPONENT_REFs and CONSTRUCTOR elements in
+ lto_fixup_types and special-case the field-decl
+ operand handling. */
+ if (ix < i)
+ lto_fixup_types (f2);
+ lto_streamer_cache_insert_at (cache, f1, ix);
+ }
+ }
/* If we found a tree that is equal to oldt replace it in the
cache, so that further users (in the various LTO sections)