From 27a0f014170db29ae423b4bf7f9b630ccc6a5973 Mon Sep 17 00:00:00 2001 From: Aldy Hernandez Date: Thu, 15 Jun 2023 17:28:21 +0200 Subject: Tidy up the range normalization code. There's a few spots where a range is being altered in-place, but we fail to call normalize the range. This patch makes sure we always call normalize_kind(), and that normalize_kind in turn calls verify_range to make sure verything is canonical. gcc/ChangeLog: * value-range.cc (frange::set): Do not call verify_range. (frange::normalize_kind): Verify range. (frange::union_nans): Do not call verify_range. (frange::union_): Same. (frange::intersect): Same. (irange::irange_single_pair_union): Call normalize_kind if necessary. (irange::union_): Same. (irange::intersect): Same. (irange::set_range_from_nonzero_bits): Verify range. (irange::set_nonzero_bits): Call normalize_kind if necessary. (irange::get_nonzero_bits): Tweak comment. (irange::intersect_nonzero_bits): Call normalize_kind if necessary. (irange::union_nonzero_bits): Same. * value-range.h (irange::normalize_kind): Verify range. --- gcc/value-range.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gcc/value-range.h') diff --git a/gcc/value-range.h b/gcc/value-range.h index 9103e9c..5d4eaf8 100644 --- a/gcc/value-range.h +++ b/gcc/value-range.h @@ -1002,6 +1002,8 @@ irange::normalize_kind () else if (m_kind == VR_ANTI_RANGE) set_undefined (); } + if (flag_checking) + verify_range (); } inline bool -- cgit v1.1