diff options
author | Bin Cheng <bin.cheng@arm.com> | 2016-11-30 14:41:09 +0000 |
---|---|---|
committer | Bin Cheng <amker@gcc.gnu.org> | 2016-11-30 14:41:09 +0000 |
commit | aec0ee116cb445f5d7bbbaff3d39f60a8f7cb118 (patch) | |
tree | 5ccf9c104099340d6ccd504008b97d48de9e3595 | |
parent | 44cd68d2b7adf87223f6e580f575c69bb6c19fa0 (diff) | |
download | gcc-aec0ee116cb445f5d7bbbaff3d39f60a8f7cb118.zip gcc-aec0ee116cb445f5d7bbbaff3d39f60a8f7cb118.tar.gz gcc-aec0ee116cb445f5d7bbbaff3d39f60a8f7cb118.tar.bz2 |
re PR tree-optimization/78574 (ice on valid C code at -O2 and -O3 in both 32- and 64-bit modes on x86_64-linux-gnu (internal compiler error: Segmentation fault (program cc1)))
PR tree-optimization/78574
* tree-ssa-loop-ivopts.c (find_deriving_biv_for_expr): Skip loop
header PHI that doesn't define biv.
gcc/testsuite
PR tree-optimization/78574
* gcc.c-torture/compile/pr78574.c: New test.
From-SVN: r243026
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr78574.c | 27 | ||||
-rw-r--r-- | gcc/tree-ssa-loop-ivopts.c | 5 |
4 files changed, 43 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ac65b1c..0fc87d2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-11-30 Bin Cheng <bin.cheng@arm.com> + + PR tree-optimization/78574 + * tree-ssa-loop-ivopts.c (find_deriving_biv_for_expr): Skip loop + header PHI that doesn't define biv. + 2016-11-30 Jakub Jelinek <jakub@redhat.com> * emit-rtl.c (verify_insn_sharing): Call verify_rtx_sharing instead of diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5aff606..eac361b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-11-30 Bin Cheng <bin.cheng@arm.com> + + PR tree-optimization/78574 + * gcc.c-torture/compile/pr78574.c: New test. + 2016-11-30 Andre Vehreschild <vehre@gcc.gnu.org> * caf/single.c (_gfortran_caf_is_present): Prevent fallthrough diff --git a/gcc/testsuite/gcc.c-torture/compile/pr78574.c b/gcc/testsuite/gcc.c-torture/compile/pr78574.c new file mode 100644 index 0000000..8c91d1e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr78574.c @@ -0,0 +1,27 @@ +/* PR tree-optimization/78574 */ + +int a, d, f, g; +int b[1]; +short h; +int main() { + long j; + int k, i; + for (; j; j++) { + i = 0; + for (; i < 6; i++) { + int l = a, m = d || g; + L: + l ^ m | a; + } + b[j + 1] = 2; + ++k; + for (; g; g++) { + d ^= h; + if (f) + for (;;) + ; + } + } + if (k) + goto L; +} diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index 5c667a2..00b287a 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -1853,6 +1853,11 @@ find_deriving_biv_for_expr (struct ivopts_data *data, tree expr) { ssa_op_iter iter; use_operand_p use_p; + basic_block phi_bb = gimple_bb (phi); + + /* Skip loop header PHI that doesn't define biv. */ + if (phi_bb->loop_father == data->current_loop) + return NULL; if (virtual_operand_p (gimple_phi_result (phi))) return NULL; |