On 10/22/18 9:08 AM, Bernd Edlinger wrote:
> Hi!
> 
> This makes c_strlen avoid an unsafe strlen folding of const arguments
> with non-const offset.  Currently a negative out of bounds offset
> makes the strlen function return an extremely large number, and
> at the same time, prevents the VRP machinery, to determine the correct
> range if the strlen function in this case.
> 
> Fixed by doing the whole computation in size_t and casting the
> result back to ssize_t.
> 
> 
> Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
> Is it OK for trunk?
> 
> 
> Thanks
> Bernd.
> 
> 
> patch-pr86572.diff
> 
> gcc:
> 2018-10-22  Bernd Edlinger  <bernd.edlin...@hotmail.de>
> 
>       PR tree-optimization/86572
>       * builtins.c (c_strlen): Handle negative offsets in a safe way.
> 
> testsuite:
> 2018-10-22  Bernd Edlinger  <bernd.edlin...@hotmail.de>
> 
>       PR tree-optimization/86572
>       * gcc.dg/pr86572.c: New test.
OK.
jeff

Reply via email to