2012-08-20 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 20 Aug 2012 10:26:45 +0000 (10:26 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 20 Aug 2012 10:26:45 +0000 (10:26 +0000)
PR tree-optimization/54327
* gimple-fold.c (get_maxval_strlen): Do not walk use-def chains
if the use is registered for SSA update.

* gcc.dg/torture/pr54327.c: New testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@190528 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/gimple-fold.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr54327.c [new file with mode: 0644]

index 04c1dfa..c33069a 100644 (file)
@@ -1,3 +1,9 @@
+2012-08-20  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/54327
+       * gimple-fold.c (get_maxval_strlen): Do not walk use-def chains
+       if the use is registered for SSA update.
+
 2012-08-20  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/54321
index d708c80..19a259e 100644 (file)
@@ -736,6 +736,11 @@ get_maxval_strlen (tree arg, tree *length, bitmap visited, int type)
       return true;
     }
 
+  /* If ARG is registered for SSA update we cannot look at its defining
+     statement.  */
+  if (name_registered_for_update_p (arg))
+    return false;
+
   /* If we were already here, break the infinite cycle.  */
   if (!bitmap_set_bit (visited, SSA_NAME_VERSION (arg)))
     return true;
index 3ef6c94..ba0b5b2 100644 (file)
@@ -1,3 +1,8 @@
+2012-08-20  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/54327
+       * gcc.dg/torture/pr54327.c: New testcase.
+
 2012-08-20  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/54321
diff --git a/gcc/testsuite/gcc.dg/torture/pr54327.c b/gcc/testsuite/gcc.dg/torture/pr54327.c
new file mode 100644 (file)
index 0000000..fe7499a
--- /dev/null
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+
+#include <string.h>
+#include <stdlib.h>
+void treathead ()
+{
+  char *a = ';' == '\0' ? : 0;
+  if (*a == '=')
+    {
+      while (*a == (*a == 0) || *a == '\'')
+       a++;
+      if (strlen (a) < 2)
+       abort ();
+    }
+}