diff mbox

Fix PR79276

Message ID alpine.LSU.2.20.1701301522320.12993@r111.fhfr.qr
State New
Headers show

Commit Message

Richard Biener Jan. 30, 2017, 2:22 p.m. UTC
Bootstrapped / tested on x86_64-unknown-linux-gnu, applied.

Richard.

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.
diff mbox

Patch

Index: gcc/tree-vrp.c
===================================================================
--- gcc/tree-vrp.c	(revision 245022)
+++ gcc/tree-vrp.c	(working copy)
@@ -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;
 	    }
Index: gcc/testsuite/gcc.dg/torture/pr79276.c
===================================================================
--- gcc/testsuite/gcc.dg/torture/pr79276.c	(nonexistent)
+++ gcc/testsuite/gcc.dg/torture/pr79276.c	(working copy)
@@ -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;
+}