[Bug tree-optimization/79196] [7 Regression] Probably invalid folding of strstr(x, "foo") eq x to memcmp (x, "foo", strlen("foo"))

marxin at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jan 23 14:58:00 GMT 2017


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

--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> ---
Author: marxin
Date: Mon Jan 23 14:57:43 2017
New Revision: 244812

URL: https://gcc.gnu.org/viewcvs?rev=244812&root=gcc&view=rev
Log:
Fix strstr folding (PR tree-optimization/79196).

2017-01-23  Martin Liska  <mliska@suse.cz>

        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.
2017-01-23  Martin Liska  <mliska@suse.cz>

        PR tree-optimization/79196
        * gcc.dg/asan/pr79196.c: New test.
        * gcc.dg/strlenopt-30.c: Update scanned pattern.

Added:
    trunk/gcc/testsuite/gcc.dg/asan/pr79196.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/strlenopt-30.c
    trunk/gcc/tree-ssa-strlen.c


More information about the Gcc-bugs mailing list