[Bug ipa/99122] [10/11 Regression] ICE in force_constant_size, at gimplify.c:733

jamborm at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Feb 18 12:42:23 GMT 2021


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

--- Comment #14 from Martin Jambor <jamborm at gcc dot gnu.org> ---
Like with the following, which seems to work as far as inlining is concerned,
but the latest Jakub's example ICEs when cloning for IPA-CP :-/  (I am also not
sure if the predicate to identify VLAs is the best one).

--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -3418,6 +3418,9 @@ force_value_to_type (tree type, tree value)
      Still if we end up with truly mismatched types here, fall back
      to using a VIEW_CONVERT_EXPR or a literal zero to not leak invalid
      GIMPLE to the following passes.  */
+  if (TREE_CODE (value) == WITH_SIZE_EXPR)
+    value = TREE_OPERAND (value, 0);
+  
   if (!is_gimple_reg_type (TREE_TYPE (value))
           || TYPE_SIZE (type) == TYPE_SIZE (TREE_TYPE (value)))
     return fold_build1 (VIEW_CONVERT_EXPR, type, value);
@@ -4017,6 +4020,10 @@ inline_forbidden_p (tree fndecl)
   wi.info = (void *) fndecl;
   wi.pset = &visited_nodes;

+  for (tree parm = DECL_ARGUMENTS (fndecl); parm; parm = DECL_CHAIN (parm))
+    if (TREE_CODE (DECL_SIZE (parm)) != INTEGER_CST)
+      return true;
+  
   FOR_EACH_BB_FN (bb, fun)
     { 
       gimple *ret;


More information about the Gcc-bugs mailing list