https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77427
--- Comment #6 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #5)
> Hmm, PR52830 looks similar.
This more generic patch fixes PR52830 as well:
...
diff --git a/gcc/tree.c b/gcc/tree.c
index 33e6f97..f5c1f6a 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -1043,7 +1043,10 @@ make_node_stat (enum tree_code code MEM_STAT_DECL)
SET_TYPE_ALIGN (t, BITS_PER_UNIT);
TYPE_USER_ALIGN (t) = 0;
TYPE_MAIN_VARIANT (t) = t;
- TYPE_CANONICAL (t) = t;
+ if (code == RECORD_TYPE)
+ SET_TYPE_STRUCTURAL_EQUALITY (t);
+ else
+ TYPE_CANONICAL (t) = t;
/* Default to no attributes for type, but let target change that. */
TYPE_ATTRIBUTES (t) = NULL_TREE;
...