aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family/c-common.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/c-family/c-common.cc')
-rw-r--r--gcc/c-family/c-common.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/gcc/c-family/c-common.cc b/gcc/c-family/c-common.cc
index 01e3d24..032dcb4 100644
--- a/gcc/c-family/c-common.cc
+++ b/gcc/c-family/c-common.cc
@@ -7115,6 +7115,13 @@ complete_array_type (tree *ptype, tree initial_value, bool do_default)
TYPE_TYPELESS_STORAGE (main_type) = TYPE_TYPELESS_STORAGE (type);
layout_type (main_type);
+ /* Set TYPE_STRUCTURAL_EQUALITY_P early. */
+ if (TYPE_STRUCTURAL_EQUALITY_P (TREE_TYPE (main_type))
+ || TYPE_STRUCTURAL_EQUALITY_P (TYPE_DOMAIN (main_type)))
+ SET_TYPE_STRUCTURAL_EQUALITY (main_type);
+ else
+ TYPE_CANONICAL (main_type) = main_type;
+
/* Make sure we have the canonical MAIN_TYPE. */
hashval_t hashcode = type_hash_canon_hash (main_type);
main_type = type_hash_canon (hashcode, main_type);
@@ -7122,7 +7129,7 @@ complete_array_type (tree *ptype, tree initial_value, bool do_default)
/* Fix the canonical type. */
if (TYPE_STRUCTURAL_EQUALITY_P (TREE_TYPE (main_type))
|| TYPE_STRUCTURAL_EQUALITY_P (TYPE_DOMAIN (main_type)))
- SET_TYPE_STRUCTURAL_EQUALITY (main_type);
+ gcc_assert (TYPE_STRUCTURAL_EQUALITY_P (main_type));
else if (TYPE_CANONICAL (TREE_TYPE (main_type)) != TREE_TYPE (main_type)
|| (TYPE_CANONICAL (TYPE_DOMAIN (main_type))
!= TYPE_DOMAIN (main_type)))
@@ -7130,8 +7137,6 @@ complete_array_type (tree *ptype, tree initial_value, bool do_default)
= build_array_type (TYPE_CANONICAL (TREE_TYPE (main_type)),
TYPE_CANONICAL (TYPE_DOMAIN (main_type)),
TYPE_TYPELESS_STORAGE (main_type));
- else
- TYPE_CANONICAL (main_type) = main_type;
if (quals == 0)
type = main_type;