2014-06-04 Richard Biener <rguenther@suse.de>
Backport from mainline
2013-05-13 Jakub Jelinek <jakub@redhat.com>
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: r211225
+2014-06-04 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2013-05-13 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/57230
+ * tree-ssa-strlen.c (handle_char_store): Add missing integer_zerop
+ check.
+
2014-05-28 Georg-Johann Lay <avr@gjlay.de>
PR target/61044
+2014-06-04 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2013-05-13 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/57230
+ * gcc.dg/strlenopt-23.c: New test.
+
2014-05-27 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/aliasing1.adb (dg-final): Robustify pattern matching.
--- /dev/null
+/* 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;
+}
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);