This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/79196] [7 Regression] Probably invalid folding of strstr(x, "foo") eq x to memcmp (x, "foo", strlen("foo"))
- From: "marxin at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 23 Jan 2017 14:58:15 +0000
- Subject: [Bug tree-optimization/79196] [7 Regression] Probably invalid folding of strstr(x, "foo") eq x to memcmp (x, "foo", strlen("foo"))
- Auto-submitted: auto-generated
- References: <bug-79196-4@http.gcc.gnu.org/bugzilla/>
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