From 4f150726cf236755158c3d895a31b4216336fae7 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 11 Mar 2019 22:58:43 +0100 Subject: [PATCH] re PR middle-end/89655 (GCC crashes building linux kernel for arm 32-bit (culprit r269453)) PR middle-end/89655 PR bootstrap/89656 * vr-values.c (vr_values::update_value_range): If old_vr->varying_p (), don't update it, make new_vr also VARYING and return false. * gcc.c-torture/compile/pr89655.c: New test. From-SVN: r269597 --- gcc/ChangeLog | 8 ++++++++ gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gcc.c-torture/compile/pr89655.c | 15 +++++++++++++++ gcc/vr-values.c | 9 +++++++-- 4 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr89655.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2d087534917..64bf6017d16 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2019-03-11 Jakub Jelinek + + PR middle-end/89655 + PR bootstrap/89656 + * vr-values.c (vr_values::update_value_range): If + old_vr->varying_p (), don't update it, make new_vr also VARYING + and return false. + 2019-03-11 Martin Liska * config/aarch64/aarch64.c (aarch64_override_options_internal): diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6ae27496180..fdc7c40e450 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-03-11 Jakub Jelinek + + PR middle-end/89655 + PR bootstrap/89656 + * gcc.c-torture/compile/pr89655.c: New test. + 2019-03-11 Christophe Lyon * gcc.target/arm/f16_f64_conv_no_dp.c: Add arm_fp16_ok effective diff --git a/gcc/testsuite/gcc.c-torture/compile/pr89655.c b/gcc/testsuite/gcc.c-torture/compile/pr89655.c new file mode 100644 index 00000000000..f304c673206 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr89655.c @@ -0,0 +1,15 @@ +/* PR middle-end/89655 */ + +int a, b, d; +char *c; + +void +foo (void) +{ + int f = a; + for (;;) + { + for (f = 0; f < (a > 3 ? : a); f++) + b = c[f] ? c[(f + 2 > a - 1 ? a - 1 : 2) * d] : 0; + } +} diff --git a/gcc/vr-values.c b/gcc/vr-values.c index a734ef93f3d..0e10aca92bb 100644 --- a/gcc/vr-values.c +++ b/gcc/vr-values.c @@ -189,8 +189,13 @@ vr_values::update_value_range (const_tree var, value_range *new_vr) because VR_RANGE and VR_ANTI_RANGE need to be considered the same. We may not have is_new when transitioning to UNDEFINED. If old_vr->type is VARYING, we shouldn't be - called. */ - if (new_vr->undefined_p ()) + called, if we are anyway, keep it VARYING. */ + if (old_vr->varying_p ()) + { + new_vr->set_varying (); + is_new = false; + } + else if (new_vr->undefined_p ()) { old_vr->set_varying (); new_vr->set_varying (); -- 2.30.2