re PR tree-optimization/79276 (ICE: Segmentation fault in VRP pass)
authorRichard Biener <rguenther@suse.de>
Mon, 30 Jan 2017 14:24:37 +0000 (14:24 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 30 Jan 2017 14:24:37 +0000 (14:24 +0000)
2017-01-30  Richard Biener  <rguenther@suse.de>

PR tree-optimization/79276
* tree-vrp.c (process_assert_insertions): Properly adjust common
when removing a duplicate.

* gcc.dg/torture/pr79276.c: New testcase.

From-SVN: r245026

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr79276.c [new file with mode: 0644]
gcc/tree-vrp.c

index 96a210e9c1e562852e5afd7429de3e6990d6f567..9339949a86ff7ae3142dda74c6d64ec182ca20ab 100644 (file)
@@ -1,3 +1,11 @@
+2017-01-30  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/79276
+       * tree-vrp.c (process_assert_insertions): Properly adjust common
+       when removing a duplicate.
+
+       * gcc.dg/torture/pr79276.c: New testcase.
+
 2017-01-30  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/79256
index f93fc0c29f78106ae7db707af43419c64f8e8006..33f02489e4ec5aeb072006cac787f26615153c97 100644 (file)
@@ -1,3 +1,8 @@
+2017-01-30  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/79276
+       * gcc.dg/torture/pr79276.c: New testcase.
+
 2017-01-30  Dominik Vogt  <vogt@linux.vnet.ibm.com>
 
        PR target/79240
diff --git a/gcc/testsuite/gcc.dg/torture/pr79276.c b/gcc/testsuite/gcc.dg/torture/pr79276.c
new file mode 100644 (file)
index 0000000..4abc2a0
--- /dev/null
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+
+short int
+ix (int *ld, short int oi)
+{
+  *ld = ((unsigned short int)oi | oi) && !!(*ld);
+  return (oi != 0) ? oi : 1;
+}
index 5c43e35d89cce921cd14eaef8a75b5f8596867c6..b429217a267db6347815f7c9aeff443ec8742170 100644 (file)
@@ -6544,6 +6544,11 @@ process_assert_insertions (void)
          else if (loc->e == asserts[j-1]->e)
            {
              /* Remove duplicate asserts.  */
+             if (commonj == j - 1)
+               {
+                 commonj = j;
+                 common = loc;
+               }
              free (asserts[j-1]);
              asserts[j-1] = NULL;
            }