Commit 3ebc22c1 by Jason Merrill Committed by Jason Merrill

re PR c++/54038 (finalize_type_size enters infinite loop becasue…

re PR c++/54038 (finalize_type_size enters infinite loop becasue TYPE_NEXT_VARIANT (variant) == variant)

	PR c++/54038
	* tree.c (build_cplus_array_type): Use build_cplus_array_type to build
	canonical array type rather than mess with its TYPE_*_VARIANT.

From-SVN: r189719
parent 824f71b9
2012-07-20 Jason Merrill <jason@redhat.com>
PR c++/54038
* tree.c (build_cplus_array_type): Use build_cplus_array_type to build
canonical array type rather than mess with its TYPE_*_VARIANT.
2012-07-19 Jason Merrill <jason@redhat.com> 2012-07-19 Jason Merrill <jason@redhat.com>
PR c++/54026 PR c++/54026
......
...@@ -795,7 +795,18 @@ build_cplus_array_type (tree elt_type, tree index_type) ...@@ -795,7 +795,18 @@ build_cplus_array_type (tree elt_type, tree index_type)
} }
} }
else else
{
if (!TYPE_STRUCTURAL_EQUALITY_P (elt_type)
&& !(index_type && TYPE_STRUCTURAL_EQUALITY_P (index_type))
&& (TYPE_CANONICAL (elt_type) != elt_type
|| (index_type && TYPE_CANONICAL (index_type) != index_type)))
/* Make sure that the canonical type is on the appropriate
variants list. */
build_cplus_array_type
(TYPE_CANONICAL (elt_type),
index_type ? TYPE_CANONICAL (index_type) : index_type);
t = build_array_type (elt_type, index_type); t = build_array_type (elt_type, index_type);
}
/* We want TYPE_MAIN_VARIANT of an array to strip cv-quals from the /* We want TYPE_MAIN_VARIANT of an array to strip cv-quals from the
element type as well, so fix it up if needed. */ element type as well, so fix it up if needed. */
...@@ -803,7 +814,6 @@ build_cplus_array_type (tree elt_type, tree index_type) ...@@ -803,7 +814,6 @@ build_cplus_array_type (tree elt_type, tree index_type)
{ {
tree m = build_cplus_array_type (TYPE_MAIN_VARIANT (elt_type), tree m = build_cplus_array_type (TYPE_MAIN_VARIANT (elt_type),
index_type); index_type);
tree c = TYPE_CANONICAL (t);
if (TYPE_MAIN_VARIANT (t) != m) if (TYPE_MAIN_VARIANT (t) != m)
{ {
...@@ -811,15 +821,6 @@ build_cplus_array_type (tree elt_type, tree index_type) ...@@ -811,15 +821,6 @@ build_cplus_array_type (tree elt_type, tree index_type)
TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (m); TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (m);
TYPE_NEXT_VARIANT (m) = t; TYPE_NEXT_VARIANT (m) = t;
} }
/* If we built a new array type for TYPE_CANONICAL, add
that to the list of variants as well. */
if (c && c != t && TYPE_MAIN_VARIANT (c) != m)
{
TYPE_MAIN_VARIANT (c) = m;
TYPE_NEXT_VARIANT (c) = t;
TYPE_NEXT_VARIANT (m) = c;
}
} }
/* Push these needs up so that initialization takes place /* Push these needs up so that initialization takes place
......
2012-07-20 Jason Merrill <jason@redhat.com>
PR c++/54038
* g++.dg/other/array7.C: New.
2012-07-20 Steven Bosscher <steven@gcc.gnu.org> 2012-07-20 Steven Bosscher <steven@gcc.gnu.org>
* gcc.dg/tree-prof/update-loopch.c: Look for counts on the dumps of * gcc.dg/tree-prof/update-loopch.c: Look for counts on the dumps of
......
// PR c++/54038
extern const char *const v[];
typedef char T;
void foo (const T *const[]);
struct A
{
static const char *const a[];
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment