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

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


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

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Martin Liška from comment #3)
> 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);
>  		    }

Of course this shouldn't make a difference.  The issue is likely a
type mismatch and 'off' being a pointer type?  Probably
mem_ref_offset () should be used to extract it.


More information about the Gcc-bugs mailing list