summaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2011-03-10 22:37:22 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2011-03-10 22:37:22 +0000
commit47c2386f65e479fad83139ff489b4006ac585286 (patch)
treeed11f647b03450960c8b2c0d83b0de6f831f7883 /gcc/tree.c
parent54cb44a3fb4e6c4b11a860835860a70076545069 (diff)
downloadgcc-47c2386f65e479fad83139ff489b4006ac585286.tar.gz
PR c++/48029
* stor-layout.c (layout_type): Don't set structural equality on arrays of incomplete type. * tree.c (type_hash_eq): Handle comparing them properly. * cp/pt.c (iterative_hash_template_arg): Remove special case for ARRAY_TYPE. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@170853 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index c947072b215..2e1b9a308bd 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -5981,12 +5981,19 @@ type_hash_eq (const void *va, const void *vb)
|| TREE_TYPE (a->type) != TREE_TYPE (b->type)
|| !attribute_list_equal (TYPE_ATTRIBUTES (a->type),
TYPE_ATTRIBUTES (b->type))
- || TYPE_ALIGN (a->type) != TYPE_ALIGN (b->type)
- || TYPE_MODE (a->type) != TYPE_MODE (b->type)
|| (TREE_CODE (a->type) != COMPLEX_TYPE
&& TYPE_NAME (a->type) != TYPE_NAME (b->type)))
return 0;
+ /* Be careful about comparing arrays before and after the element type
+ has been completed; don't compare TYPE_ALIGN unless both types are
+ complete. */
+ if (COMPLETE_OR_UNBOUND_ARRAY_TYPE_P (a->type)
+ && COMPLETE_OR_UNBOUND_ARRAY_TYPE_P (b->type)
+ && (TYPE_ALIGN (a->type) != TYPE_ALIGN (b->type)
+ || TYPE_MODE (a->type) != TYPE_MODE (b->type)))
+ return 0;
+
switch (TREE_CODE (a->type))
{
case VOID_TYPE: