aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2017-04-27 15:42:37 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2017-04-27 15:42:37 +0200
commitf8a36447dbdf5baafe85f953c261ec35f149dfb7 (patch)
tree69656f2b41db491442a54946801bbcfbc2ded408 /gcc/tree.c
parent304757d2ceec74e12ac43312b7eab9aa3b092126 (diff)
downloadgcc-f8a36447dbdf5baafe85f953c261ec35f149dfb7.zip
gcc-f8a36447dbdf5baafe85f953c261ec35f149dfb7.tar.gz
gcc-f8a36447dbdf5baafe85f953c261ec35f149dfb7.tar.bz2
re PR c++/80534 (7.1 RC - internal compiler error: in finish_member_declaration, at cp/semantics.c:2963)
PR c++/80534 * tree.c (type_cache_hasher::equal): Only compare TYPE_TYPELESS_STORAGE flag on non-aggregate element types. (build_array_type_1): Only hash TYPE_TYPELESS_STORAGE flag on non-aggregate element types. * tree.h (TYPE_TYPELESS_STORAGE): Fix comment typo, add more details about the flag on ARRAY_TYPEs in the comment, formatting fix. c-family/ * c-common.c (complete_array_type): Only hash TYPE_TYPELESS_STORAGE flag on non-aggregate element types. testsuite/ * g++.dg/other/pr80534-1.C: New test. * g++.dg/other/pr80534-2.C: New test. From-SVN: r247334
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 826af99..bef0071 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -7073,9 +7073,16 @@ type_cache_hasher::equal (type_hash *a, type_hash *b)
break;
return 0;
case ARRAY_TYPE:
- return (TYPE_TYPELESS_STORAGE (a->type)
- == TYPE_TYPELESS_STORAGE (b->type)
- && TYPE_DOMAIN (a->type) == TYPE_DOMAIN (b->type));
+ /* Don't compare TYPE_TYPELESS_STORAGE flag on aggregates,
+ where the flag should be inherited from the element type
+ and can change after ARRAY_TYPEs are created; on non-aggregates
+ compare it and hash it, scalars will never have that flag set
+ and we need to differentiate between arrays created by different
+ front-ends or middle-end created arrays. */
+ return (TYPE_DOMAIN (a->type) == TYPE_DOMAIN (b->type)
+ && (AGGREGATE_TYPE_P (TREE_TYPE (a->type))
+ || (TYPE_TYPELESS_STORAGE (a->type)
+ == TYPE_TYPELESS_STORAGE (b->type))));
case RECORD_TYPE:
case UNION_TYPE:
@@ -8386,7 +8393,8 @@ build_array_type_1 (tree elt_type, tree index_type, bool typeless_storage,
hstate.add_object (TYPE_HASH (elt_type));
if (index_type)
hstate.add_object (TYPE_HASH (index_type));
- hstate.add_flag (typeless_storage);
+ if (!AGGREGATE_TYPE_P (elt_type))
+ hstate.add_flag (TYPE_TYPELESS_STORAGE (t));
t = type_hash_canon (hstate.end (), t);
}