backport: re PR tree-optimization/57230 (tree-ssa-strlen incorrectly optimizes a strlen to 0)
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
This commit is contained in:
parent
c403aa6dce
commit
2900601426
|
@ -1,3 +1,12 @@
|
|||
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
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
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.
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
/* 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;
|
||||
}
|
|
@ -1693,7 +1693,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);
|
||||
|
|
Loading…
Reference in New Issue