aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2013-12-02 20:36:58 -0700
committerJeff Law <law@gcc.gnu.org>2013-12-02 20:36:58 -0700
commit4dd0ef2765ed87adce1dadc3187d6f7bd7ff29bb (patch)
treec012f6dfb1604892c329a5bd69465aea214dc3f0 /gcc
parent80f1fd0dabb30f82a972b5eb114a7d47104263a3 (diff)
downloadgcc-4dd0ef2765ed87adce1dadc3187d6f7bd7ff29bb.zip
gcc-4dd0ef2765ed87adce1dadc3187d6f7bd7ff29bb.tar.gz
gcc-4dd0ef2765ed87adce1dadc3187d6f7bd7ff29bb.tar.bz2
re PR tree-optimization/59322 (ICE with segfault on valid code at -O1, -O2, and -O3 on x86_64-linux-gnu)
PR tree-optimization/59322 * tree-ssa-threadedge.c (create_edge_and_update_destination_phis): Remove code which copied jump threading paths. PR tree-optimization/59322 * gcc.c-torture/compile/pr59322.c: New test From-SVN: r205617
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr59322.c16
-rw-r--r--gcc/tree-ssa-threadupdate.c35
4 files changed, 42 insertions, 20 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index df4c84c..a9202c7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2013-12-02 Jeff Law <law@redhat.com>
+
+ PR tree-optimization/59322
+ * tree-ssa-threadedge.c (create_edge_and_update_destination_phis):
+ Remove code which copied jump threading paths.
+
2013-12-02 Sriraman Tallam <tmsriram@google.com>
PR target/58944
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 579c59b..80490ce 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2013-12-02 Jeff Law <law@redhat.com>
+
+ PR tree-optimization/59322
+ * gcc.c-torture/compile/pr59322.c: New test
+
2013-12-02 Sriraman Tallam <tmsriram@google.com>
PR target/58944
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr59322.c b/gcc/testsuite/gcc.c-torture/compile/pr59322.c
new file mode 100644
index 0000000..918d6bd
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr59322.c
@@ -0,0 +1,16 @@
+
+int a, b, d;
+short c;
+
+int
+foo ()
+{
+ for (b = 0; b; b = a)
+ for (c = 18; c < 10; c++)
+ {
+ d = c;
+ if (d)
+ return 0;
+ }
+ return 0;
+}
diff --git a/gcc/tree-ssa-threadupdate.c b/gcc/tree-ssa-threadupdate.c
index 24d0f42..ad727a1 100644
--- a/gcc/tree-ssa-threadupdate.c
+++ b/gcc/tree-ssa-threadupdate.c
@@ -421,27 +421,22 @@ create_edge_and_update_destination_phis (struct redirection_data *rd,
e->probability = REG_BR_PROB_BASE;
e->count = bb->count;
- /* We have to copy path -- which means creating a new vector as well
- as all the jump_thread_edge entries. */
- if (rd->path->last ()->e->aux)
- {
- vec<jump_thread_edge *> *path = THREAD_PATH (rd->path->last ()->e);
- vec<jump_thread_edge *> *copy = new vec<jump_thread_edge *> ();
+ /* We used to copy the thread path here. That was added in 2007
+ and dutifully updated through the representation changes in 2013.
- /* Sadly, the elements of the vector are pointers and need to
- be copied as well. */
- for (unsigned int i = 0; i < path->length (); i++)
- {
- jump_thread_edge *x
- = new jump_thread_edge ((*path)[i]->e, (*path)[i]->type);
- copy->safe_push (x);
- }
- e->aux = (void *)copy;
- }
- else
- {
- e->aux = NULL;
- }
+ In 2013 we added code to thread from an interior node through
+ the backedge to another interior node. That runs after the code
+ to thread through loop headers from outside the loop.
+
+ The latter may delete edges in the CFG, including those
+ which appeared in the jump threading path we copied here. Thus
+ we'd end up using a dangling pointer.
+
+ After reviewing the 2007/2011 code, I can't see how anything
+ depended on copying the AUX field and clearly copying the jump
+ threading path is problematical due to embedded edge pointers.
+ It has been removed. */
+ e->aux = NULL;
/* If there are any PHI nodes at the destination of the outgoing edge
from the duplicate block, then we will need to add a new argument