Commit 3a60f32b by Jakub Jelinek Committed by Jakub Jelinek

re PR tree-optimization/57230 (tree-ssa-strlen incorrectly optimizes a strlen to 0)

	PR tree-optimization/57230
	* tree-ssa-strlen.c (handle_char_store): Add missing integer_zerop
	check.

	* gcc.dg/strlenopt-23.c: New test.

From-SVN: r198813
parent 2710a27a
2013-05-13 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/57230
* tree-ssa-strlen.c (handle_char_store): Add missing integer_zerop
check.
2013-05-12 Joern Rennecke <joern.rennecke@embecosm.com>
* config/epiphany/epiphany.c (epiphany_init): Check size of
......
2013-05-13 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/57230
* gcc.dg/strlenopt-23.c: New test.
2013-05-12 Oleg Endo <olegendo@gcc.gnu.org>
PR target/57108
......
/* PR tree-optimization/57230 */
/* { dg-do run } */
/* { dg-options "-O2" } */
#include "strlenopt.h"
int
main ()
{
char p[] = "hello world";
p[0] = (char) (strlen (p) - 1);
if (strlen (p) != 11)
abort ();
return 0;
}
......@@ -1703,7 +1703,7 @@ handle_char_store (gimple_stmt_iterator *gsi)
its length may be decreased. */
adjust_last_stmt (si, stmt, false);
}
else if (si != NULL)
else if (si != NULL && integer_zerop (gimple_assign_rhs1 (stmt)))
{
si = unshare_strinfo (si);
si->length = build_int_cst (size_type_node, 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment