diff options
author | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-03-11 22:32:11 +0000 |
---|---|---|
committer | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-03-11 22:32:11 +0000 |
commit | 841166713da31fbd725b5f523fd9d321446522a8 (patch) | |
tree | 1c289de319b6b0e834082080de232185abce2ed8 | |
parent | d68ee525b94909513ec78399dae6daaa84b7144c (diff) |
PR tree-optimization/70190
* tree-ssa-threadbackward.c (fsm_find_control_statement_thread_paths):
Handle cases where we can not extract the taken edge, even though we
found a constant value.
PR tree-optimization/70190
* gcc.c-torture/compile/pr70190.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@234151 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr70190.c | 14 | ||||
-rw-r--r-- | gcc/tree-ssa-threadbackward.c | 10 |
4 files changed, 34 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f3a73515480..1bc7ab5c8d3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2016-03-11 Jeff Law <law@redhat.com> + PR tree-optimization/70190 + * tree-ssa-threadbackward.c (fsm_find_control_statement_thread_paths): + Handle cases where we can not extract the taken edge, even though we + found a constant value. + PR tree-optimization/64058 * tree-ssa-coalesce.c (struct coalesce_pair): Add new field INDEX. (num_coalesce_pairs): Move up earlier in file. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f42e9437553..e48430c6f74 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-03-11 Jeff Law <law@redhat.com> + + PR tree-optimization/70190 + * gcc.c-torture/compile/pr70190.c: New test. + 2016-03-11 David Malcolm <dmalcolm@redhat.com> PR c/68187 diff --git a/gcc/testsuite/gcc.c-torture/compile/pr70190.c b/gcc/testsuite/gcc.c-torture/compile/pr70190.c new file mode 100644 index 00000000000..d3d209ace98 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr70190.c @@ -0,0 +1,14 @@ +/* { dg-require-effective-target indirect_jumps } */ +/* { dg-require-effective-target label_values } */ + + +int +fn1 () +{ + static char a[] = "foo"; + static void *b[] = { &&l1, &&l2 }; + goto *(b[1]); + l1: goto *(a[0]); + l2: return 0; +} + diff --git a/gcc/tree-ssa-threadbackward.c b/gcc/tree-ssa-threadbackward.c index 6f1b7573e5d..88f8d5eb778 100644 --- a/gcc/tree-ssa-threadbackward.c +++ b/gcc/tree-ssa-threadbackward.c @@ -385,6 +385,16 @@ fsm_find_control_statement_thread_paths (tree name, We have to know the outgoing edge to figure this out. */ edge taken_edge = find_taken_edge ((*path)[0], arg); + + /* There are cases where we may not be able to extract the + taken edge. For example, a computed goto to an absolute + address. Handle those cases gracefully. */ + if (taken_edge == NULL) + { + path->pop (); + continue; + } + bool creates_irreducible_loop = false; if (threaded_through_latch && loop == taken_edge->dest->loop_father |