all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dmitry Antipov <dmantipov@yandex.ru>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: 18361@debbugs.gnu.org
Subject: bug#18361: New 'sort' implementation can crash Emacs
Date: Sat, 30 Aug 2014 10:55:17 +0400	[thread overview]
Message-ID: <54017555.8010903@yandex.ru> (raw)
In-Reply-To: <54015FA8.5070400@cs.ucla.edu>

On 08/30/2014 09:22 AM, Paul Eggert wrote:

> See, for example,
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42157
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51297

Very nice.  But couldn't we detect an improper comparison
function at runtime?  For example:

=== modified file 'src/fns.c'
--- src/fns.c   2014-08-29 19:18:06 +0000
+++ src/fns.c   2014-08-30 06:52:20 +0000
@@ -1933,6 +1933,8 @@
       preserve original order.  Pretty ugly but works.  */
    more = NILP (call2 (sort_vector_predicate, vp, vq));
    less = NILP (call2 (sort_vector_predicate, vq, vp));
+  if (!more && !less)
+    error ("Not an anti-symmetrical predicate in sort");
    return ((more && !less) ? 1
           : ((!more && less) ? -1
              : XSAVE_INTEGER (op, 0) - XSAVE_INTEGER (oq, 0)));

Dmitry






  reply	other threads:[~2014-08-30  6:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-29 21:24 bug#18361: New 'sort' implementation can crash Emacs Paul Eggert
2014-08-29 22:47 ` Dmitry Antipov
2014-08-29 23:07   ` Paul Eggert
2014-08-30  5:07     ` Dmitry Antipov
2014-08-30  5:22       ` Paul Eggert
2014-08-30  6:55         ` Dmitry Antipov [this message]
2014-08-30 13:44           ` Paul Eggert
2014-08-30 23:05             ` Paul Eggert
2014-08-31  2:50               ` Eli Zaretskii
2014-08-31  4:46                 ` Paul Eggert
2014-08-31 15:20                   ` Eli Zaretskii

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=54017555.8010903@yandex.ru \
    --to=dmantipov@yandex.ru \
    --cc=18361@debbugs.gnu.org \
    --cc=eggert@cs.ucla.edu \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.