===================================================================
@@ -6523,8 +6523,9 @@ remove_range_assertions (void)
}
else
{
+ if (!is_gimple_debug (gsi_stmt (si)))
+ is_unreachable = 0;
gsi_next (&si);
- is_unreachable = 0;
}
}
}
===================================================================
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fcompare-debug" } */
+
+void
+f1 (int n, int b)
+{
+ extern void f2 (int);
+ int j;
+
+ if (b)
+ n = 1;
+
+ if (n < 1)
+ __builtin_unreachable ();
+
+ for (j = 0; j < n; j++)
+ f2 (j);
+}