public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Alexander Monakov <amonakov@ispras.ru>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH 2/6] gimple-ssa-store-merging.c: fix sort_by_bitpos
Date: Sat, 15 Jul 2017 20:49:00 -0000	[thread overview]
Message-ID: <20170715204749.24398-3-amonakov@ispras.ru> (raw)
In-Reply-To: <20170715204749.24398-1-amonakov@ispras.ru>

This qsort comparator lacks anti-commutativity and can indicate
A < B < A if A and B have the same bitpos.  Return 0 in that case.

	* gimple-ssa-store-merging.c (sort_by_bitpos): Return 0 on equal bitpos.
---
 gcc/gimple-ssa-store-merging.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/gimple-ssa-store-merging.c b/gcc/gimple-ssa-store-merging.c
index 64b8351..c99960b 100644
--- a/gcc/gimple-ssa-store-merging.c
+++ b/gcc/gimple-ssa-store-merging.c
@@ -516,12 +516,12 @@ sort_by_bitpos (const void *x, const void *y)
   store_immediate_info *const *tmp = (store_immediate_info * const *) x;
   store_immediate_info *const *tmp2 = (store_immediate_info * const *) y;
 
-  if ((*tmp)->bitpos <= (*tmp2)->bitpos)
+  if ((*tmp)->bitpos < (*tmp2)->bitpos)
     return -1;
   else if ((*tmp)->bitpos > (*tmp2)->bitpos)
     return 1;
-
-  gcc_unreachable ();
+  else
+    return 0;
 }
 
 /* Sorting function for store_immediate_info objects.
-- 
1.8.3.1

  parent reply	other threads:[~2017-07-15 20:49 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-15 20:49 [PATCH 0/6] qsort comparator consistency fixes Alexander Monakov
2017-07-15 20:48 ` [PATCH 3/6] lra-assigns.c: fix pseudo_compare_func Alexander Monakov
2017-07-19  6:50   ` Jeff Law
2017-07-15 20:49 ` [PATCH 6/6] qsort comparator consistency checking Alexander Monakov
2017-07-31 18:06   ` Jeff Law
2017-07-31 18:28     ` Alexander Monakov
2017-08-02 17:16       ` Jeff Law
2017-08-02 17:29   ` Jeff Law
2017-08-02 18:00     ` Alexander Monakov
2017-08-02 18:08       ` Jeff Law
2017-08-03 14:25         ` Alexander Monakov
2017-08-03 15:33           ` Jeff Law
2017-08-03 15:53             ` Jakub Jelinek
2017-08-03 16:23               ` Alexander Monakov
2017-08-03 16:27                 ` Oleg Endo
2017-08-03 16:31                   ` Alexander Monakov
2017-08-03 16:35                     ` Oleg Endo
2017-08-03 16:28                 ` Jakub Jelinek
2017-08-07 14:07                 ` Pedro Alves
2017-08-09 16:35                 ` Jeff Law
2017-08-10 13:35                   ` Alexander Monakov
2017-08-24  6:27                     ` Jeff Law
2017-08-09 16:31               ` Jeff Law
2017-07-15 20:49 ` [PATCH 1/6] tree-vrp: fix compare_assert_loc qsort comparator Alexander Monakov
2017-07-19  6:51   ` Jeff Law
2017-07-15 20:49 ` [PATCH 4/6] lra-assigns.c: give up on qsort checking in assign_by_spills Alexander Monakov
2017-07-18 19:51   ` Yuri Gribov
2017-07-31 17:42   ` Jeff Law
2017-07-15 20:49 ` Alexander Monakov [this message]
2017-07-19  6:50   ` [PATCH 2/6] gimple-ssa-store-merging.c: fix sort_by_bitpos Jeff Law
2017-07-22 11:15   ` Segher Boessenkool
2017-07-24 20:49     ` Alexander Monakov
2017-07-25  8:34       ` Kyrill Tkachov
2017-07-25  8:47         ` Richard Biener
2017-07-25 16:03         ` Alexander Monakov
2017-07-15 20:49 ` [PATCH 5/6] haifa-sched.c: give up qsort checking when autoprefetch heuristic is in use Alexander Monakov
2017-07-31 17:44   ` Jeff Law
2017-07-21 14:30 ` [PATCH 7/6] fortran: fix pair_cmp qsort comparator Alexander Monakov
2017-07-23 11:39   ` Thomas Koenig

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=20170715204749.24398-3-amonakov@ispras.ru \
    --to=amonakov@ispras.ru \
    --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).