PR tree-optimization/87415
* tree-vrp.c (set_value_range_with_overflow): Special case one bit
precision fields.
From-SVN: r264817
+2018-10-03 Aldy Hernandez <aldyh@redhat.com>
+
+ PR tree-optimization/87415
+ * tree-vrp.c (set_value_range_with_overflow): Special case one bit
+ precision fields.
+
2018-10-02 Jeff Law <law@redhat.com>
* gimple-fold.c (get_range_strlen): Only set *nonstr when
--- /dev/null
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+struct A
+{
+ int b:1;
+};
+
+int d;
+
+int main ()
+{
+ struct A e = { 0 };
+ if (!d)
+ e.b = -1;
+ if (!e.b)
+ __builtin_abort ();
+
+ return 0;
+}
const unsigned int prec = TYPE_PRECISION (type);
vr.type = VR_RANGE;
vr.equiv = NULL;
+
+ /* For one bit precision if max < min, then the swapped
+ range covers all values. */
+ if (prec == 1 && wi::lt_p (wmax, wmin, sgn))
+ {
+ set_value_range_to_varying (&vr);
+ return;
+ }
+
if (TYPE_OVERFLOW_WRAPS (type))
{
/* If overflow wraps, truncate the values and adjust the