On Mon, Jan 23, 2017 at 02:58:05PM +0100, Martin Liška wrote:
> As mentioned in the PR, it should be valid to use strncmp instead of memcmp
> because first argument of a strstr can be shorter than a second (known) 
> argument.
> 
> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
> 
> Ready to be installed?
> Martin

> >From 4a9dcb24d82ce1793a281710ce1ddab59f9dd7a8 Mon Sep 17 00:00:00 2001
> From: marxin <mli...@suse.cz>
> Date: Mon, 23 Jan 2017 13:18:37 +0100
> Subject: [PATCH] Fix strstr folding (PR tree-optimization/79196).
> 
> gcc/ChangeLog:
> 
> 2017-01-23  Martin Liska  <mli...@suse.cz>
> 
>       * tree-ssa-strlen.c (fold_strstr_to_memcmp): Rename
>       to fold_strstr_to_strncmp and fold the pattern to strncmp
>       instead of memcmp.

Please write it as:
        PR tree-optimization/79196
        * tree-ssa-strlen.c (fold_strstr_to_memcmp): Rename to ...
        (fold_strstr_to_strncmp): ... this.  Fold the pattern to strncmp
        instead of memcmp.

>       (strlen_optimize_stmt): Call the renamed function.
> 
> gcc/testsuite/ChangeLog:
> 
> 2017-01-23  Martin Liska  <mli...@suse.cz>
> 
>       * gcc.dg/asan/pr79196.c: New test.
>       * gcc.dg/strlenopt-30.c: Update scanned pattern.

Ok, thanks.

        Jakub

Reply via email to