diff mbox series

[range-ops] Minor readability fix.

Message ID 20221115163135.604240-1-aldyh@redhat.com
State New
Headers show
Series [range-ops] Minor readability fix. | expand

Commit Message

Aldy Hernandez Nov. 15, 2022, 4:31 p.m. UTC
I know it's past the end of stage1, but I'm afraid we'll drag this
around forever in the GCC12 branch, and it's an easy readbility fix.

p.s. Or if you prefer:

if (!lb_nan && !ub_nan && !maybe_nan && ....)
  r.clear_nan ();

OK for trunk?

gcc/ChangeLog:

	* range-op-float.cc (range_operator_float::fold_range): Make check
	for maybe_isnan more readable.
---
 gcc/range-op-float.cc | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Jeff Law Nov. 17, 2022, 2:15 a.m. UTC | #1
On 11/15/22 09:31, Aldy Hernandez via Gcc-patches wrote:
> I know it's past the end of stage1, but I'm afraid we'll drag this
> around forever in the GCC12 branch, and it's an easy readbility fix.
>
> p.s. Or if you prefer:
>
> if (!lb_nan && !ub_nan && !maybe_nan && ....)
>    r.clear_nan ();
>
> OK for trunk?
>
> gcc/ChangeLog:
>
> 	* range-op-float.cc (range_operator_float::fold_range): Make check
> 	for maybe_isnan more readable.

Your call.  I think we're so early in stage3 that if you think this is 
uber-safe go for it.

jeff
diff mbox series

Patch

diff --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc
index 53a0928c6aa..86107e16553 100644
--- a/gcc/range-op-float.cc
+++ b/gcc/range-op-float.cc
@@ -83,10 +83,12 @@  range_operator_float::fold_range (frange &r, tree type,
 
   r.set (type, lb, ub);
 
-  if (lb_nan || ub_nan || maybe_nan)
+  if (lb_nan || ub_nan || maybe_nan
+      || op1.maybe_isnan ()
+      || op2.maybe_isnan ())
     // Keep the default NAN (with a varying sign) set by the setter.
     ;
-  else if (!op1.maybe_isnan () && !op2.maybe_isnan ())
+  else
     r.clear_nan ();
 
   return true;