From 480570898d36d1d8e29d2adb35bc7eb46b876092 Mon Sep 17 00:00:00 2001 From: Kugan Vivekanandarajah Date: Thu, 6 Oct 2016 19:58:46 +0000 Subject: [PATCH] re PR tree-optimization/77862 (ice in add_equivalence) Fix PR77862 gcc/testsuite/ChangeLog: 2016-10-06 Kugan Vivekanandarajah PR tree-optimization/77862 * gcc.dg/pr77862.c: New test. gcc/ChangeLog: 2016-10-06 Kugan Vivekanandarajah PR tree-optimization/77862 * tree-vrp.c (add_equivalence): Use get_value_range so that num_vr_values is checked before accessing vr_values. From-SVN: r240842 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr77862.c | 19 +++++++++++++++++++ gcc/tree-vrp.c | 2 +- 4 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/pr77862.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b4ce1a73031..55bb91b641a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-10-06 Kugan Vivekanandarajah + + PR tree-optimization/77862 + * tree-vrp.c (add_equivalence): Use get_value_range so that + num_vr_values is checked before accessing vr_values. + 2016-10-06 Kugan Vivekanandarajah * tree-vrp.c (evrp_dom_walker::before_dom_children): Handle diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e41e168efad..24026c80d47 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-10-06 Kugan Vivekanandarajah + + PR tree-optimization/77862 + * gcc.dg/pr77862.c: New test. + 2016-10-06 Kugan Vivekanandarajah * gcc.dg/tree-ssa/evrp4.c: New test. diff --git a/gcc/testsuite/gcc.dg/pr77862.c b/gcc/testsuite/gcc.dg/pr77862.c new file mode 100644 index 00000000000..e9096d2fbee --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr77862.c @@ -0,0 +1,19 @@ + +/* PR tree-optimization/77862 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fPIC -w" } */ + +struct paramed_type +{ +}; +int a; + +int memcmp ( int*, void *, long ); + +void +cur_token (void) +{ + if ( 1 != a || memcmp ( cur_token, "", a ) ) + return; + struct paramed_type b = { }; +} diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 46bbd823bfc..c9ecf3db740 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -842,7 +842,7 @@ static void add_equivalence (bitmap *equiv, const_tree var) { unsigned ver = SSA_NAME_VERSION (var); - value_range *vr = vr_value[ver]; + value_range *vr = get_value_range (var); if (*equiv == NULL) *equiv = BITMAP_ALLOC (&vrp_equiv_obstack); -- 2.30.2