[1/5] fix anti-range dumping

Message ID 20230228134718.2C43413440@imap2.suse-dmz.suse.de
State Accepted
Headers
Series Fix irange::legacy_upper_bound |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Richard Biener Feb. 28, 2023, 1:47 p.m. UTC
  when vrange_printer::visit gets a VR_ANTI_RANGE it should print it
as such, not just print the first element as range.  When
irange::num_pairs and upper/lower_bound are fixed that would no
longer print a canonicalized anti-range.

	* value-range-pretty-print.cc (vrange_printer::visit):
	Handle all VR_ANTI_RANGE specially.
---
 gcc/value-range-pretty-print.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Aldy Hernandez March 1, 2023, 10:08 a.m. UTC | #1
Ughh, you're touching everything I'm nuking next release ;-).

But yes, that's an oversight.

OK.

On Tue, Feb 28, 2023 at 2:48 PM Richard Biener via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> when vrange_printer::visit gets a VR_ANTI_RANGE it should print it
> as such, not just print the first element as range.  When
> irange::num_pairs and upper/lower_bound are fixed that would no
> longer print a canonicalized anti-range.
>
>         * value-range-pretty-print.cc (vrange_printer::visit):
>         Handle all VR_ANTI_RANGE specially.
> ---
>  gcc/value-range-pretty-print.cc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gcc/value-range-pretty-print.cc b/gcc/value-range-pretty-print.cc
> index d20e2562431..23817f48a3d 100644
> --- a/gcc/value-range-pretty-print.cc
> +++ b/gcc/value-range-pretty-print.cc
> @@ -64,7 +64,7 @@ vrange_printer::visit (const irange &r) const
>        return;
>      }
>    // Handle legacy symbolics.
> -  if (!r.constant_p ())
> +  if (!r.constant_p () || r.kind () == VR_ANTI_RANGE)
>      {
>        if (r.kind () == VR_ANTI_RANGE)
>         pp_character (pp, '~');
> --
> 2.35.3
>
  

Patch

diff --git a/gcc/value-range-pretty-print.cc b/gcc/value-range-pretty-print.cc
index d20e2562431..23817f48a3d 100644
--- a/gcc/value-range-pretty-print.cc
+++ b/gcc/value-range-pretty-print.cc
@@ -64,7 +64,7 @@  vrange_printer::visit (const irange &r) const
       return;
     }
   // Handle legacy symbolics.
-  if (!r.constant_p ())
+  if (!r.constant_p () || r.kind () == VR_ANTI_RANGE)
     {
       if (r.kind () == VR_ANTI_RANGE)
 	pp_character (pp, '~');