From: rguenth Date: Sun, 6 Sep 2009 16:49:48 +0000 (+0000) Subject: 2009-09-06 Richard Guenther X-Git-Tag: upstream/4.9.2~33915 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c8de116dd87b9f7a0e0c2cb5713356d9a83069f7;p=platform%2Fupstream%2Flinaro-gcc.git 2009-09-06 Richard Guenther PR middle-end/41144 * tree.c (build_array_type): Do not record types marked with structural equality in the canonical type hashtable. * g++.dg/torture/pr41144.C: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151461 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 80be045..76d93f6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2009-09-06 Richard Guenther + PR middle-end/41144 + * tree.c (build_array_type): Do not record types marked + with structural equality in the canonical type hashtable. + +2009-09-06 Richard Guenther + PR middle-end/41261 * tree-ssa-alias.c (refs_may_alias_p_1): Bail out for function decls. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4712bc5..b14aaf0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2009-09-06 Richard Guenther + PR middle-end/41144 + * g++.dg/torture/pr41144.C: New testcase. + +2009-09-06 Richard Guenther + PR middle-end/41261 * gcc.dg/torture/pr41261.c: New testcase. diff --git a/gcc/testsuite/g++.dg/torture/pr41144.C b/gcc/testsuite/g++.dg/torture/pr41144.C new file mode 100644 index 0000000..64dc117 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr41144.C @@ -0,0 +1,23 @@ +/* { dg-do compile } */ + +struct rgba8; +template class span_gouraud { +public: + struct coord_type { }; + coord_type m_coord[3]; +}; +template class span_gouraud_rgba : public span_gouraud +{ + typedef ColorT color_type; + typedef span_gouraud base_type; + typedef typename base_type::coord_type coord_type; +public: + void prepare() { + coord_type coord[3]; + } +}; +void the_application() { + typedef span_gouraud_rgba gouraud_span_gen_type; + gouraud_span_gen_type span_gouraud; + span_gouraud.prepare(); +} diff --git a/gcc/tree.c b/gcc/tree.c index 1db7d0a..a036439 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -6906,44 +6906,29 @@ build_array_type (tree elt_type, tree index_type) t = make_node (ARRAY_TYPE); TREE_TYPE (t) = elt_type; TYPE_DOMAIN (t) = index_type; - - if (index_type == 0) - { - tree save = t; - hashcode = iterative_hash_object (TYPE_HASH (elt_type), hashcode); - t = type_hash_canon (hashcode, t); - if (save == t) - layout_type (t); - - if (TYPE_CANONICAL (t) == t) - { - if (TYPE_STRUCTURAL_EQUALITY_P (elt_type)) - SET_TYPE_STRUCTURAL_EQUALITY (t); - else if (TYPE_CANONICAL (elt_type) != elt_type) - TYPE_CANONICAL (t) - = build_array_type (TYPE_CANONICAL (elt_type), index_type); - } + layout_type (t); - return t; - } + /* If the element type is incomplete at this point we get marked for + structural equality. Do not record these types in the canonical + type hashtable. */ + if (TYPE_STRUCTURAL_EQUALITY_P (t)) + return t; hashcode = iterative_hash_object (TYPE_HASH (elt_type), hashcode); - hashcode = iterative_hash_object (TYPE_HASH (index_type), hashcode); + if (index_type) + hashcode = iterative_hash_object (TYPE_HASH (index_type), hashcode); t = type_hash_canon (hashcode, t); - if (!COMPLETE_TYPE_P (t)) - layout_type (t); - if (TYPE_CANONICAL (t) == t) { if (TYPE_STRUCTURAL_EQUALITY_P (elt_type) - || TYPE_STRUCTURAL_EQUALITY_P (index_type)) + || (index_type && TYPE_STRUCTURAL_EQUALITY_P (index_type))) SET_TYPE_STRUCTURAL_EQUALITY (t); else if (TYPE_CANONICAL (elt_type) != elt_type - || TYPE_CANONICAL (index_type) != index_type) + || (index_type && TYPE_CANONICAL (index_type) != index_type)) TYPE_CANONICAL (t) = build_array_type (TYPE_CANONICAL (elt_type), - TYPE_CANONICAL (index_type)); + index_type ? TYPE_CANONICAL (index_type) : NULL); } return t;