[Bug tree-optimization/90866] [10 Regression] ICE in fold_binary_loc, at fold-const.c:9827 since r272197

marxin at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jun 13 09:28:00 GMT 2019


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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |NEW
           Assignee|marxin at gcc dot gnu.org          |unassigned at gcc dot gnu.org

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
So my patch survives bootstrap and regression tests, can you please Martin take
the issue?

Patch candidate:
diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c
index 944650cecd5..a9b1147a2e7 100644
--- a/gcc/tree-ssa-strlen.c
+++ b/gcc/tree-ssa-strlen.c
@@ -324,7 +324,7 @@ get_stridx (tree exp)
                      off = TREE_OPERAND (ptr, 1);
                      /* Scale the array index by the size of the element
                         type (normally 1 for char).  */
-                     off = fold_build2 (MULT_EXPR, TREE_TYPE (off), off,
+                     off = fold_build2 (MULT_EXPR, TREE_TYPE (eltsize), off,
                                         eltsize);
                      ptr = TREE_OPERAND (ptr, 0);
                    }


More information about the Gcc-bugs mailing list