Change x mod 0 to undefined.

Message ID a29965ca-69e0-1ae2-f042-a9003e61f506@redhat.com
State New
Headers show
Series
  • Change x mod 0 to undefined.
Related show

Commit Message

Andre Vehreschild via Gcc-patches May 7, 2021, 7:02 p.m.
We were setting x % 0 to varying...  change it to undefined.

Bootstraps on  x86_64-pc-linux-gnu with no testsuite regressions.

Pushed.

Andrew

Patch

commit 2262206b82da0ab4050fe6168a7d09be4e4b3d0f
Author: Andrew MacLeod <amacleod@redhat.com>
Date:   Mon Apr 26 17:46:31 2021 -0400

    Change x mod 0 to produce UNDEFINED rather than VARYING.
    
            * range-ops.cc (operator_trunc_mod::wi_fold): x % 0 is UNDEFINED.

diff --git a/gcc/range-op.cc b/gcc/range-op.cc
index 0027b3e1427..ab8f4e211ac 100644
--- a/gcc/range-op.cc
+++ b/gcc/range-op.cc
@@ -2689,7 +2689,7 @@  operator_trunc_mod::wi_fold (irange &r, tree type,
   // Mod 0 is undefined.
   if (wi_zero_p (type, rh_lb, rh_ub))
     {
-      r.set_varying (type);
+      r.set_undefined ();
       return;
     }