This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Make strlen range computations more conservative


[ I'm still digesting, but saw something in this that ought to be broken
out... ]

On 08/19/2018 09:55 AM, Bernd Edlinger wrote:
> diff -Npur gcc/tree-ssa-dse.c gcc/tree-ssa-dse.c
> --- gcc/tree-ssa-dse.c	2018-07-18 21:21:34.000000000 +0200
> +++ gcc/tree-ssa-dse.c	2018-08-19 14:29:32.344498771 +0200
> @@ -248,6 +248,12 @@ compute_trims (ao_ref *ref, sbitmap live
>  	 residual handling in mem* and str* functions is usually
>  	 reasonably efficient.  */
>        *trim_tail = last_orig - last_live;
> +      /* Don't fold away an out of bounds access, as this defeats proper
> +	 warnings.  */
> +      if (*trim_tail
> +	  && compare_tree_int (TYPE_SIZE_UNIT (TREE_TYPE (ref->base)),
> +			       last_orig) <= 0)
> +	*trim_tail = 0;
>      }
>    else
>      *trim_tail = 0;
This seems like a good change in and of itself and should be able to go
forward without further review work.   Consider this hunk approved,
along with any testsuite you have which tickles this code (I didn't
immediately see one attached to this patch.  But I could have missed it).

Jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]