diff mbox series

[COMMITTED] Use Value_Range when applying inferred ranges.

Message ID 0dfdbb0d-3ea3-70e6-7a16-51bcc0d9a86c@redhat.com
State New
Headers show
Series [COMMITTED] Use Value_Range when applying inferred ranges. | expand

Commit Message

Andrew MacLeod Oct. 19, 2022, 4:04 p.m. UTC
Apply a non-integral inferred range could trap because I was using an 
int_range_max as the temp.  doh.   Fortunately there are no inferred 
floating points at this point in time.

Bootstrapped on x86_64-pc-linux-gnu with no regressions.  Pushed.

Andrew
diff mbox series

Patch

commit 69a233610f6b27cd4283561569d8ce0f35044dc4
Author: Andrew MacLeod <amacleod@redhat.com>
Date:   Wed Oct 19 09:21:22 2022 -0400

    Use Value_Range when applying inferred ranges.
    
    Applying an inferred range is using int_range_ma as the
    temporary rather than the general purpose Value_Range.  This causes it
    to trap if we have a non-integral inferred range.
    
            * gimple-range-cache.cc (ranger_cache::range_from_dom): Use
              Value_Range not int_range_max.

diff --git a/gcc/gimple-range-cache.cc b/gcc/gimple-range-cache.cc
index 0b9aa3639c5..f279371948a 100644
--- a/gcc/gimple-range-cache.cc
+++ b/gcc/gimple-range-cache.cc
@@ -1546,7 +1546,6 @@  ranger_cache::range_from_dom (vrange &r, tree name, basic_block start_bb,
 void
 ranger_cache::apply_inferred_ranges (gimple *s)
 {
-  int_range_max r;
   bool update = true;
 
   basic_block bb = gimple_bb (s);
@@ -1572,6 +1571,7 @@  ranger_cache::apply_inferred_ranges (gimple *s)
       m_exit.add_range (name, bb, infer.range (x));
       if (update)
 	{
+	  Value_Range r (TREE_TYPE (name));
 	  if (!m_on_entry.get_bb_range (r, name, bb))
 	    exit_range (r, name, bb, RFD_READ_ONLY);
 	  if (r.intersect (infer.range (x)))