re PR tree-optimization/77862 (ice in add_equivalence)
authorKugan Vivekanandarajah <kuganv@linaro.org>
Thu, 6 Oct 2016 19:58:46 +0000 (19:58 +0000)
committerKugan Vivekanandarajah <kugan@gcc.gnu.org>
Thu, 6 Oct 2016 19:58:46 +0000 (19:58 +0000)
Fix PR77862
gcc/testsuite/ChangeLog:

2016-10-06  Kugan Vivekanandarajah  <kuganv@linaro.org>

PR tree-optimization/77862
* gcc.dg/pr77862.c: New test.

gcc/ChangeLog:

2016-10-06  Kugan Vivekanandarajah  <kuganv@linaro.org>

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
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr77862.c [new file with mode: 0644]
gcc/tree-vrp.c

index b4ce1a73031567a060e64dabf4b8d427edbe8ede..55bb91b641a8106d4eb7fbc154fbfe78b469c493 100644 (file)
@@ -1,3 +1,9 @@
+2016-10-06  Kugan Vivekanandarajah  <kuganv@linaro.org>
+
+       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  <kuganv@linaro.org>
 
        * tree-vrp.c (evrp_dom_walker::before_dom_children): Handle
index e41e168efade517c0df94224bae43bba2fff301d..24026c80d47e155d671f55e6ac6e8326061485ba 100644 (file)
@@ -1,3 +1,8 @@
+2016-10-06  Kugan Vivekanandarajah  <kuganv@linaro.org>
+
+       PR tree-optimization/77862
+       * gcc.dg/pr77862.c: New test.
+
 2016-10-06  Kugan Vivekanandarajah  <kuganv@linaro.org>
 
        * 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 (file)
index 0000000..e9096d2
--- /dev/null
@@ -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 = { };
+}
index 46bbd823bfcbda77aefc9750e58af87d4088b0c1..c9ecf3db740f63caad3c72956a239401aab2b284 100644 (file)
@@ -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);