Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Dubiec <jdx@o2.pl>
To: Jeff Law <jeffrey.law@oss.qualcomm.com>, Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] H8/300: sim: Fix simulator hang caused by qsort on Windows/MinGW.
Date: Mon, 31 Aug 2026 17:36:51 +0200	[thread overview]
Message-ID: <9c86da7c-c394-4f58-b8fa-6c265ad37952@o2.pl> (raw)
In-Reply-To: <c517e5b7-8605-4c80-a3eb-d3e07e5320cf@oss.qualcomm.com>

On 31.08.2026 16:09, Jeff Law wrote:
> 
> 
> On 8/29/26 7:40 PM, Jan Dubiec wrote:
>> On 27.08.2026 17:19, Tom Tromey wrote:
>>>>>>>> "Jan" == Jan Dubiec <jdx@o2.pl> writes:
>>>
>>> Jan> So I think the best solution is to use a sorting algorithm known 
>>> to be
>>> Jan> stable on every host, e.g. the insertion sort implementation 
>>> from my
>>> Jan> previous message.
>>>
>>> Would it be possible to change the comparison function to be stable?
>>
>> It is impossible by definition, because stability is a property of the 
>> sorting algorithm, not the comparator. However, the comparator can be 
>> modified in such a way that an unstable sorting algorithm produces a 
>> “good enough” result.
> When the comparator returns "0", the order of those two elements is 
> unspecified  in the final output of qsort.  That introduces host 
> dependencies in behavior that we very much want to avoid.
> 
> The traditional way to fix that is to fix the comparator to not return 0 
> by introducing additional sort keys.    He may have been a bit imprecise 
> by saying "change the comparison function to be stable", but the intent 
> is clear and consistent with how this issue has been handled through the 
> decades.
OK, then I’ll repost the comparator patch in a new thread in a few hours.

/J.D.


      reply	other threads:[~2026-08-31 15:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-22 11:02 Jan Dubiec
2026-08-23 20:50 ` Jan Dubiec
2026-08-27 15:19   ` Tom Tromey
2026-08-30  1:40     ` Jan Dubiec
2026-08-31 14:09       ` Jeff Law
2026-08-31 15:36         ` Jan Dubiec [this message]

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=9c86da7c-c394-4f58-b8fa-6c265ad37952@o2.pl \
    --to=jdx@o2.pl \
    --cc=gdb-patches@sourceware.org \
    --cc=jeffrey.law@oss.qualcomm.com \
    --cc=tom@tromey.com \
    /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