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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The problem is that tree-inline.c will remap variably_modified_type_p types
unconditionally.
I've tried:
--- gcc/tree-inline.c.jj        2019-03-11 22:56:55.888667590 +0100
+++ gcc/tree-inline.c   2019-03-20 15:28:59.207677470 +0100
@@ -595,6 +595,18 @@ remap_type_1 (tree type, copy_body_data
       walk_tree (&TYPE_SIZE_UNIT (new_tree), copy_tree_body_r, id, NULL);
     }

+  if (TREE_CODE (new_tree) == ARRAY_TYPE
+      && !TYPE_STRUCTURAL_EQUALITY_P (new_tree))
+    {
+      hashval_t hash = type_hash_canon_hash (new_tree);
+      tree t = type_hash_canon (hash, new_tree);
+      if (t != new_tree)
+       {
+         insert_decl_map (id, type, t);
+         return t;
+       }
+    }
+
   return new_tree;
 }

but that doesn't help, as Fortran doesn't use TYPE_CANONICAL.
Another possibility would be walk the type first and for all the decls found
there check if remap_decl returns something different from the decl, and if
not, remap type to itself.
Yet another possibility is just fold_convert the types to avoid the assert and
hope for the best.

Reply via email to