From: Jakub Jelinek Date: Fri, 14 Dec 2018 23:17:03 +0000 (+0100) Subject: re PR rtl-optimization/88478 (valgrind error in cselib_record_sets) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bbc8d04f0e238cd5e86c240021b2c0aaf1b58d1b;p=gcc.git re PR rtl-optimization/88478 (valgrind error in cselib_record_sets) PR rtl-optimization/88478 * cselib.c (cselib_record_sets): Move sets[i].src_elt tests after REG_P (dest) test. * g++.dg/opt/pr88478.C: New test. From-SVN: r267159 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 492d9001e65..1ae1cc75633 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-12-15 Jakub Jelinek + + PR rtl-optimization/88478 + * cselib.c (cselib_record_sets): Move sets[i].src_elt tests + after REG_P (dest) test. + 2018-12-14 Martin Sebor PR tree-optimization/88372 diff --git a/gcc/cselib.c b/gcc/cselib.c index 4a68439455f..9d68e3c9723 100644 --- a/gcc/cselib.c +++ b/gcc/cselib.c @@ -2616,10 +2616,10 @@ cselib_record_sets (rtx_insn *insn) preserves the upper bits that di:SI=zero_extend(flags:CCNO<=0). */ scalar_int_mode mode; if (dest != orig - && sets[i].src_elt && cselib_record_sets_hook && REG_P (dest) && HARD_REGISTER_P (dest) + && sets[i].src_elt && is_a (GET_MODE (dest), &mode) && n_sets + n_strict_low_parts < MAX_SETS) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 24d9ee661e1..8931a4c12ec 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-12-15 Jakub Jelinek + + PR rtl-optimization/88478 + * g++.dg/opt/pr88478.C: New test. + 2018-12-14 Martin Sebor PR tree-optimization/88372 diff --git a/gcc/testsuite/g++.dg/opt/pr88478.C b/gcc/testsuite/g++.dg/opt/pr88478.C new file mode 100644 index 00000000000..2081aad993e --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr88478.C @@ -0,0 +1,17 @@ +// PR rtl-optimization/88478 +// { dg-do compile } +// { dg-options "-O2" } + +struct A { + bool b; + int s; + template + A (T, U) {} +}; +enum F {} f; + +A +foo () +{ + return A (false, f); +}