[committed] VRP: Treat all divisions by zero as VR_UNDEFINED.
diff mbox series

Message ID 2d4984ff-db02-03c0-77b9-73d0695b59f1@redhat.com
State New
Headers show
Series
  • [committed] VRP: Treat all divisions by zero as VR_UNDEFINED.
Related show

Commit Message

Aldy Hernandez Sept. 11, 2018, 10:18 a.m. UTC
Doing this was approved by Richi at some point when I rewrote the 
division code.  I finally got around to testing it.

Committed.

Patch
diff mbox series

gcc/

	* tree-vrp (extract_range_from_binary_expr_1): Treat all divisions
	by zero as VR_UNDEFINED.

diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 8f16713300c..a82cf3e36c1 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -1601,12 +1601,7 @@  extract_range_from_binary_expr_1 (value_range *vr,
       /* Special case explicit division by zero as undefined.  */
       if (range_is_null (&vr1))
 	{
-	  /* However, we must not eliminate a division by zero if
-	     flag_non_call_exceptions.  */
-	  if (cfun->can_throw_non_call_exceptions)
-	    set_value_range_to_varying (vr);
-	  else
-	    set_value_range_to_undefined (vr);
+	  set_value_range_to_undefined (vr);
 	  return;
 	}