re PR tree-optimization/66123 (Array of labels as values + ternary operator + pointer...
authorRichard Biener <rguenther@suse.de>
Wed, 13 May 2015 10:59:49 +0000 (10:59 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 13 May 2015 10:59:49 +0000 (10:59 +0000)
2015-05-13  Richard Biener  <rguenther@suse.de>

PR tree-optimization/66123
* tree-ssa-dom.c (propagate_rhs_into_lhs): Check if we found
a taken edge.

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

From-SVN: r223130

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr66123.c [new file with mode: 0644]
gcc/tree-ssa-dom.c

index aa9c72e1dd689cfe8966431bcab82a623b8aa37c..d9a4fe43173cee9cff9f49de0168f5e2f85d7add 100644 (file)
@@ -1,3 +1,9 @@
+2015-05-13  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/66123
+       * tree-ssa-dom.c (propagate_rhs_into_lhs): Check if we found
+       a taken edge.
+
 2015-05-13  Richard Biener  <rguenther@suse.de>
 
        PR middle-end/66110
index be355503c3a7e5443c886cd8de575c78d21d9973..8dcf8cb49ecad770185e248be5554a89f27c8ece 100644 (file)
@@ -1,3 +1,8 @@
+2015-05-13  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/66123
+       * gcc.dg/torture/pr66123.c: New testcase.
+
 2015-05-13  Richard Biener  <rguenther@suse.de>
 
        PR middle-end/66110
diff --git a/gcc/testsuite/gcc.dg/torture/pr66123.c b/gcc/testsuite/gcc.dg/torture/pr66123.c
new file mode 100644 (file)
index 0000000..848f8fe
--- /dev/null
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+
+int
+test (int foo)
+{
+  static void *dummy[] = { &&a, &&b };
+  goto *((char *) &&b - 2 * (foo < 0));
+a:
+b:
+  return 0;
+}
index 14f3e9ef928cbb5d76a734798b81b4218b37cad1..42324ee6214b5e29fbde19ebbb4f484a5bd3868d 100644 (file)
@@ -2918,6 +2918,9 @@ propagate_rhs_into_lhs (gimple stmt, tree lhs, tree rhs, bitmap interesting_name
                {
                  basic_block bb = gimple_bb (use_stmt);
                  edge te = find_taken_edge (bb, val);
+                 if (!te)
+                   continue;
+
                  edge_iterator ei;
                  edge e;
                  gimple_stmt_iterator gsi;