From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 126853 invoked by alias); 11 May 2018 12:44:09 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 126823 invoked by uid 89); 11 May 2018 12:44:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=drink, coffee X-HELO: gate.crashing.org Received: from gate.crashing.org (HELO gate.crashing.org) (63.228.1.57) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 11 May 2018 12:44:06 +0000 Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id w4BCi3CR016390; Fri, 11 May 2018 07:44:03 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id w4BCi25I016386; Fri, 11 May 2018 07:44:02 -0500 Date: Fri, 11 May 2018 12:52:00 -0000 From: Segher Boessenkool To: Alexander Monakov Cc: Richard Biener , gcc-patches@gcc.gnu.org Subject: Re: [PATCH 0/2] Introduce gcc_qsort Message-ID: <20180511124402.GE17342@gate.crashing.org> References: <20180510155641.2950-1-amonakov@ispras.ru> <82E69EBE-92EB-41AB-8E1B-ADBD65516D73@gmail.com> <20180511102905.GC17342@gate.crashing.org> <20180511111732.GD17342@gate.crashing.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-IsSubscribed: yes X-SW-Source: 2018-05/txt/msg00556.txt.bz2 On Fri, May 11, 2018 at 03:03:09PM +0300, Alexander Monakov wrote: > On Fri, 11 May 2018, Segher Boessenkool wrote: > > > In general such address-based comparisons steps are invalid; they lack > > > anti-reflexivity. So comparators are not actually allowed to do that. > > > > I don't know what you mean here? Every comparator is required to be > > *reflexive*! Subtracting two pointers to elements of the same array gives > > a perfectly fine total order as far as I see (it is the same as the > > difference between the array indices of those elements). > > I meant "anti-commutativity"; sorry about the mixup. Such strategy does not > give a valid total order because the order changes while in-progress sorting > reorders elements: Ah. Right. C11 7.22.5/4. Sorry for being dense, I'll drink more coffee. Segher