public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Do not use bit and for conjunction of predicates (PR c/81272).
@ 2018-02-19 13:43 Martin Liška
  2018-02-19 16:45 ` Jeff Law
  0 siblings, 1 reply; 2+ messages in thread
From: Martin Liška @ 2018-02-19 13:43 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 569 bytes --]

Hi.

This changes code to be consistent:

      if (!decNumberIsNegative(lhs) & decNumberIsNegative(rhs)) {
...
	 else if (decNumberIsQNaN(lhs) && decNumberIsSNaN(rhs)) result=+1;

That's fixed in the patch.
Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.

Ready to be installed?
Martin


libdecnumber/ChangeLog:

2018-02-19  Martin Liska  <mliska@suse.cz>

	PR c/81272
	* decNumber.c (decCompareOp): Do not use bit and
	for conjunction of predicates.
---
 libdecnumber/decNumber.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)



[-- Attachment #2: 0001-Do-not-use-bit-and-for-conjunction-of-predicates-PR-.patch --]
[-- Type: text/x-patch, Size: 693 bytes --]

diff --git a/libdecnumber/decNumber.c b/libdecnumber/decNumber.c
index ebfb6c5dd96..e4194211fdc 100644
--- a/libdecnumber/decNumber.c
+++ b/libdecnumber/decNumber.c
@@ -6029,11 +6029,11 @@ decNumber * decCompareOp(decNumber *res, const decNumber *lhs,
 
     /* If total ordering then handle differing signs 'up front' */
     if (op==COMPTOTAL) {		/* total ordering */
-      if (decNumberIsNegative(lhs) & !decNumberIsNegative(rhs)) {
+      if (decNumberIsNegative(lhs) && !decNumberIsNegative(rhs)) {
 	result=-1;
 	break;
 	}
-      if (!decNumberIsNegative(lhs) & decNumberIsNegative(rhs)) {
+      if (!decNumberIsNegative(lhs) && decNumberIsNegative(rhs)) {
 	result=+1;
 	break;
 	}


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

* Re: [PATCH] Do not use bit and for conjunction of predicates (PR c/81272).
  2018-02-19 13:43 [PATCH] Do not use bit and for conjunction of predicates (PR c/81272) Martin Liška
@ 2018-02-19 16:45 ` Jeff Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2018-02-19 16:45 UTC (permalink / raw)
  To: Martin Liška, gcc-patches

On 02/19/2018 06:43 AM, Martin Liška wrote:
> Hi.
> 
> This changes code to be consistent:
> 
>       if (!decNumberIsNegative(lhs) & decNumberIsNegative(rhs)) {
> ...
> 	 else if (decNumberIsQNaN(lhs) && decNumberIsSNaN(rhs)) result=+1;
> 
> That's fixed in the patch.
> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
> 
> Ready to be installed?
> Martin
> 
> 
> libdecnumber/ChangeLog:
> 
> 2018-02-19  Martin Liska  <mliska@suse.cz>
> 
> 	PR c/81272
> 	* decNumber.c (decCompareOp): Do not use bit and
> 	for conjunction of predicates.
OK

jeff

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

end of thread, other threads:[~2018-02-19 16:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-19 13:43 [PATCH] Do not use bit and for conjunction of predicates (PR c/81272) Martin Liška
2018-02-19 16:45 ` 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).