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
This commit is contained in:
Jason Merrill 2011-03-10 17:37:22 -05:00
parent 67a2f76d4c
commit 18d920539d
7 changed files with 37 additions and 15 deletions

View File

@ -1,7 +1,14 @@
2011-03-10 Jason Merrill <jason@redhat.com>
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.
2011-03-10 Jakub Jelinek <jakub@redhat.com>
PR debug/48043
* config/s390/s390.c (s390_delegitimize_address): Make sure the
* config/s390/s390.c (s390_delegitimize_address): Make sure the
result mode matches original rtl mode.
2011-03-10 Nick Clifton <nickc@redhat.com>

View File

@ -1,5 +1,9 @@
2011-03-10 Jason Merrill <jason@redhat.com>
PR c++/48029
* pt.c (iterative_hash_template_arg): Remove special case for
ARRAY_TYPE.
PR c++/47198
* parser.c (cp_parser_single_declaration): Just return if
cp_parser_parse_and_diagnose_invalid_type_name complained.

View File

@ -1569,13 +1569,6 @@ iterative_hash_template_arg (tree arg, hashval_t val)
val = iterative_hash_object (code, val);
return iterative_hash_template_arg (TREE_OPERAND (arg, 2), val);
case ARRAY_TYPE:
/* layout_type sets structural equality for arrays of
incomplete type, so we can't rely on the canonical type
for hashing. */
val = iterative_hash_template_arg (TREE_TYPE (arg), val);
return iterative_hash_template_arg (TYPE_DOMAIN (arg), val);
case LAMBDA_EXPR:
/* A lambda can't appear in a template arg, but don't crash on
erroneous input. */

View File

@ -2028,11 +2028,6 @@ layout_type (tree type)
#else
TYPE_ALIGN (type) = MAX (TYPE_ALIGN (element), BITS_PER_UNIT);
#endif
if (!TYPE_SIZE (element))
/* We don't know the size of the underlying element type, so
our alignment calculations will be wrong, forcing us to
fall back on structural equality. */
SET_TYPE_STRUCTURAL_EQUALITY (type);
TYPE_USER_ALIGN (type) = TYPE_USER_ALIGN (element);
SET_TYPE_MODE (type, BLKmode);
if (TYPE_SIZE (type) != 0

View File

@ -1,5 +1,7 @@
2011-03-10 Jason Merrill <jason@redhat.com>
* g++.dg/template/array22.C: New.
* g++.dg/cpp0x/syntax-err1.C: New.
* g++.dg/parse/error36.C: Adjust expected errors.
* g++.old-deja/g++.pt/ctor2.C: Likewise.

View File

@ -0,0 +1,14 @@
// PR c++/48029
template <class T> struct A { };
template <class T, class U> struct B
{
struct N { };
typedef U u;
};
typedef B<int, A<int>(*)[2]> btype;
A<int> v1[2];
btype v2;

View File

@ -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: