]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Teach SCCVN that throwing expressions are not to be regenerated.
authorAndrew MacLeod <amacleod@redhat.com>
Thu, 17 Jan 2008 21:37:14 +0000 (21:37 +0000)
committerAndrew Macleod <amacleod@gcc.gnu.org>
Thu, 17 Jan 2008 21:37:14 +0000 (21:37 +0000)
http://gcc.gnu.org/ml/gcc-patches/2008-01/msg00764.html

Teach SCCVN that throwing expressions are not to be regenerated.

2008-01-17  Andrew MacLeod  <amacleod@redhat.com>

* tree-ssa-sccvn.c (visit_use): Expressions which can throw are varying. * gcc.c-torture/compile/pr34648.c: New testcase.

From-SVN: r131610

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr34648.c [new file with mode: 0644]
gcc/tree-ssa-sccvn.c

index d00143afc385e37a9dfe23a33970dadc65ee7700..91874635b8b3c0facea1940cf2b4d1f85dc17cde 100644 (file)
@@ -1,3 +1,8 @@
+2008-01-17  Andrew MacLeod  <amacleod@redhat.com>
+
+       PR tree-optimization/34648
+       * tree-ssa-sccvn.c (visit_use): Expressions which can throw are varying.
+
 2008-01-17  Anatoly Sokolov <aesok@post.ru>
 
        * config/avr/avr.h (LINK_SPEC): Support -mrelax and -mpmem-wrap-around.
index 3a460685243b8de44a5cf663510aacba00a8aa90..eb8a26cf610f15ac886e902e6c70b2004b52ad63 100644 (file)
@@ -1,3 +1,8 @@
+2008-01-17  Andrew MacLeod  <amacleod@redhat.com>
+
+       PR tree-optimization/34648
+       * gcc.c-torture/compile/pr34648.c: New testcase.
+
 2008-01-17  Sebastian Pop  <sebastian.pop@amd.com>
 
        PR testsuite/34821
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34648.c b/gcc/testsuite/gcc.c-torture/compile/pr34648.c
new file mode 100644 (file)
index 0000000..1f7472f
--- /dev/null
@@ -0,0 +1,39 @@
+/* PR tree-optimization/34648 */
+
+/* { dg-do compile } */
+/* { dg-options "-O2 -fexceptions" } */
+
+extern const unsigned short int **bar (void) __attribute__ ((const));
+const char *a;
+int b;
+char c;
+
+char
+foo (int *x)
+{
+  char r;
+
+  c = '\0';
+  if (!b)
+    {
+      while (((*bar ())[a[*x]] & 0x2000) != 0)
+        (*x)++;
+      if (a[++(*x)] == '-')
+        {
+          (*x)++;
+          if (a[*x] && !((*bar ())[a[*x]] & 0x2000))
+            return '?';
+        }
+      if (!a[*x] || ((*bar ())[a[*x]] & 0x2000))
+        {
+          while (((*bar ())[a[*x]] & 0x2000))
+            ++(*x);
+          return '\0';
+        }
+    }
+
+  r = a[*x];
+  b = a[*x] && !((*bar ())[a[*x]] & 0x2000);
+  return r;
+}
+
index 7f566dba8e1c417c71d401f1dd8d7a175e3eb1f8..d7b8c8a72d7fb990d1f24e868f787dd6a6953b6c 100644 (file)
@@ -1609,7 +1609,8 @@ visit_use (tree use)
          changed = visit_phi (stmt);
        }
       else if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT
-              || (ann && ann->has_volatile_ops))
+              || (ann && ann->has_volatile_ops)
+              || tree_could_throw_p (stmt))
        {
          changed = defs_to_varying (stmt);
        }