public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Martin Liška" <mliska@suse.cz>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] Do not use bit and for conjunction of predicates (PR c/81272).
Date: Mon, 19 Feb 2018 13:43:00 -0000	[thread overview]
Message-ID: <7aea6151-d206-209f-a6ab-0a27f45ea914@suse.cz> (raw)

[-- 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;
 	}


             reply	other threads:[~2018-02-19 13:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-19 13:43 Martin Liška [this message]
2018-02-19 16:45 ` Jeff Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7aea6151-d206-209f-a6ab-0a27f45ea914@suse.cz \
    --to=mliska@suse.cz \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).