This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/71521] [6/7 Regression] Regression in GCC-7.0.0's optimizer


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71521

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
  <bb 4>:
  # RANGE [0, 2147483647] NONZERO 2147483647
  _2 = 1 / 0;
  # RANGE [0, 1073741823] NONZERO 1073741823
  iftmp.0_5 = _2 >> 1;
  if (iftmp.0_5 != 0)

so the testcase is somewhat artificial ... 

                  /* For unsigned division when value ranges for dividend
                     and divisor are available.  */
                  if (vr1.type == VR_RANGE
                      && !symbolic_range_p (&vr0)
                      && !symbolic_range_p (&vr1))
                    min = int_const_binop (code, vr0.min, vr1.max);
                  else
                    min = zero;

int_const_binop will return NULL_TREE for vr1.max == 0.

@@ -2938,7 +2944,8 @@ extract_range_from_binary_expr_1 (value_
                     and divisor are available.  */
                  if (vr1.type == VR_RANGE
                      && !symbolic_range_p (&vr0)
-                     && !symbolic_range_p (&vr1))
+                     && !symbolic_range_p (&vr1)
+                     && compare_values (vr1.min, zero) != 0)
                    min = int_const_binop (code, vr0.min, vr1.max);
                  else
                    min = zero;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]