OSDN Git Service

http://gcc.gnu.org/ml/gcc-patches/2008-01/msg00764.html
authoramacleod <amacleod@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 17 Jan 2008 21:37:14 +0000 (21:37 +0000)
committeramacleod <amacleod@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 17 Jan 2008 21:37:14 +0000 (21:37 +0000)
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.

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

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

index d00143a..9187463 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 3a46068..eb8a26c 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 7f566db..d7b8c8a 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);
        }