aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorJason Merrill <jason@gcc.gnu.org>2011-03-10 17:37:22 -0500
committerJason Merrill <jason@gcc.gnu.org>2011-03-10 17:37:22 -0500
commit18d920539d6d7f5be5a1eb58613da4f91f26fbfb (patch)
treeed11f647b03450960c8b2c0d83b0de6f831f7883 /gcc/tree.c
parent67a2f76d4c054da755bd23ef9a08854b3340b715 (diff)
downloadgcc-18d920539d6d7f5be5a1eb58613da4f91f26fbfb.zip
gcc-18d920539d6d7f5be5a1eb58613da4f91f26fbfb.tar.gz
gcc-18d920539d6d7f5be5a1eb58613da4f91f26fbfb.tar.bz2
re PR c++/48029 (ICE in finish_member_declaration() with --param ggc-min-expand=0 --param ggc-min-heapsize=0)
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. From-SVN: r170853
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 c947072..2e1b9a3 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: