public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] [range-ops] Minor readability fix.
@ 2022-11-15 16:31 Aldy Hernandez
  2022-11-17  2:15 ` Jeff Law
  0 siblings, 1 reply; 2+ messages in thread
From: Aldy Hernandez @ 2022-11-15 16:31 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: GCC patches, Andrew MacLeod, Aldy Hernandez

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(-)

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;
-- 
2.38.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] [range-ops] Minor readability fix.
  2022-11-15 16:31 [PATCH] [range-ops] Minor readability fix Aldy Hernandez
@ 2022-11-17  2:15 ` Jeff Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2022-11-17  2:15 UTC (permalink / raw)
  To: Aldy Hernandez, Jakub Jelinek; +Cc: GCC patches, Andrew MacLeod


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



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-11-17  2:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-15 16:31 [PATCH] [range-ops] Minor readability fix Aldy Hernandez
2022-11-17  2:15 ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).