From: Jakub Jelinek Date: Thu, 9 Nov 2017 23:58:51 +0000 (+0100) Subject: re PR rtl-optimization/82913 (ICE: Segmentation fault in try_merge_compare) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e9b8a6284773c0043fe160db62fa834c9b6a5cab;p=gcc.git re PR rtl-optimization/82913 (ICE: Segmentation fault in try_merge_compare) PR rtl-optimization/82913 * compare-elim.c (try_merge_compare): Punt if def_insn is not single set. * gcc.c-torture/compile/pr82913.c: New test. From-SVN: r254614 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0c6f9489389..f2de9142e6a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-11-10 Jakub Jelinek + + PR rtl-optimization/82913 + * compare-elim.c (try_merge_compare): Punt if def_insn is not + single set. + 2017-11-09 Jeff Law * vr-values.h: New file with vr_values class. diff --git a/gcc/compare-elim.c b/gcc/compare-elim.c index 17d08842d15..b34a07f8336 100644 --- a/gcc/compare-elim.c +++ b/gcc/compare-elim.c @@ -683,6 +683,8 @@ try_merge_compare (struct comparison *cmp) rtx_insn *def_insn = cmp->in_a_setter; rtx set = single_set (def_insn); + if (!set) + return false; if (!can_merge_compare_into_arith (cmp_insn, def_insn)) return false; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 17fa7662880..f50bee7ad5f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-11-10 Jakub Jelinek + + PR rtl-optimization/82913 + * gcc.c-torture/compile/pr82913.c: New test. + 2017-11-09 Paul Thomas PR fortran/78619 diff --git a/gcc/testsuite/gcc.c-torture/compile/pr82913.c b/gcc/testsuite/gcc.c-torture/compile/pr82913.c new file mode 100644 index 00000000000..5cf55573204 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr82913.c @@ -0,0 +1,23 @@ +/* PR rtl-optimization/82913 */ + +unsigned int a; +unsigned long int b; + +int +foo (void) +{ + ++a; + b = 0; +} + +unsigned long int +bar (int x) +{ + if (!foo () || !a) + { + int c = a != b; + if (c != x) + return a; + } + return 0; +}