https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114574

--- Comment #8 from uecker at gcc dot gnu.org ---

If we do not care too much about TYPE_CANONICAL being correct in this case
anyway, we could turn off the test and add a condition flag_isoc23 as a
precaution in the FE to not risk any other regressions for pre C23.  Otherwise
we could revert the fix to PR114361 but this also does not seem ideal.


diff --git a/gcc/c/c-decl.cc b/gcc/c/c-decl.cc
index f2083b9d96f..efdbe1a3bde 100644
--- a/gcc/c/c-decl.cc
+++ b/gcc/c/c-decl.cc
@@ -9722,7 +9722,8 @@ finish_struct (location_t loc, tree t, tree fieldlist,
tree attributes,
       C_TYPE_VARIABLE_SIZE (x) = C_TYPE_VARIABLE_SIZE (t);
       C_TYPE_VARIABLY_MODIFIED (x) = C_TYPE_VARIABLY_MODIFIED (t);
       C_TYPE_INCOMPLETE_VARS (x) = NULL_TREE;
-      TYPE_CANONICAL (x) = TYPE_CANONICAL (t);
+      if (flag_isoc23)
+       TYPE_CANONICAL (x) = TYPE_CANONICAL (t);
     }

   /* Update type location to the one of the definition, instead of e.g.
diff --git a/gcc/ipa-free-lang-data.cc b/gcc/ipa-free-lang-data.cc
index 16ed55e2e5a..0b75f05fab3 100644
--- a/gcc/ipa-free-lang-data.cc
+++ b/gcc/ipa-free-lang-data.cc
@@ -254,8 +254,11 @@ fld_incomplete_type_of (tree t, class free_lang_data_d
*fld)
          else
            first = build_reference_type_for_mode (t2, TYPE_MODE (t),
                                                   TYPE_REF_CAN_ALIAS_ALL (t));
+         // FIXME: temporarily decativated because of PR114493
+#if 0
          gcc_assert (TYPE_CANONICAL (t2) != t2
                      && TYPE_CANONICAL (t2) == TYPE_CANONICAL (TREE_TYPE
(t)));
+#endif
          if (!fld->pset.add (first))
            add_tree_to_fld_list (first, fld);
          return fld_type_variant (first, t, fld);

Reply via email to