From 7d22d5a3ec5d0a2564e1b1a8feb6b3b1625a42e9 Mon Sep 17 00:00:00 2001 From: Kugan Vivekanandarajah Date: Fri, 9 Dec 2016 19:47:10 +0000 Subject: [PATCH] re PR tree-optimization/78721 (ICE on valid code at -O2 and -O3 on x86_64-linux-gnu: in set_value_range, at tree-vrp.c:371) gcc/testsuite/ChangeLog: 2016-12-09 Kugan Vivekanandarajah PR ipa/78721 * gcc.dg/pr78721.c: New test. gcc/ChangeLog: 2016-12-09 Kugan Vivekanandarajah PR ipa/78721 * ipa-cp.c (propagate_vr_accross_jump_function): drop_tree_overflow after fold_convert. From-SVN: r243501 --- gcc/ChangeLog | 6 ++++++ gcc/ipa-cp.c | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr78721.c | 23 +++++++++++++++++++++++ 4 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/pr78721.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b36a14c4b6e..eedb11b1201 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-12-09 Kugan Vivekanandarajah + + PR ipa/78721 + * ipa-cp.c (propagate_vr_accross_jump_function): drop_tree_overflow + after fold_convert. + 2016-12-09 Jakub Jelinek PR target/72742 diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index 2ec671ffff6..4ec7cc5dfeb 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -1895,9 +1895,9 @@ propagate_vr_accross_jump_function (cgraph_edge *cs, tree val = ipa_get_jf_constant (jfunc); if (TREE_CODE (val) == INTEGER_CST) { + val = fold_convert (param_type, val); if (TREE_OVERFLOW_P (val)) val = drop_tree_overflow (val); - val = fold_convert (param_type, val); jfunc->vr_known = true; jfunc->m_vr.type = VR_RANGE; jfunc->m_vr.min = val; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ac7abfd357b..db4765bfad7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-12-09 Kugan Vivekanandarajah + + PR ipa/78721 + * gcc.dg/pr78721.c: New test. + 2016-12-09 Jakub Jelinek PR target/72742 diff --git a/gcc/testsuite/gcc.dg/pr78721.c b/gcc/testsuite/gcc.dg/pr78721.c new file mode 100644 index 00000000000..fb2ffc30eb0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr78721.c @@ -0,0 +1,23 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +int a, b, c; + +int fn1 (char e, char f) +{ + return !f || (e && f == 1); +} + +void fn2 (char e) +{ + while (b) + e = 0; + a = 128; + c = fn1 (e, a == e); +} + +int main () +{ + fn2 (0); + return 0; +} -- 2.30.2