all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Vibhav Pant <vibhavp@gmail.com>
To: Kaushal Modi <kaushal.modi@gmail.com>
Cc: 25941@debbugs.gnu.org, Oleh Krehel <ohwoeowho@gmail.com>
Subject: bug#25941: 26.0.50; Different code behavior between using the auto-compiled and evaled versions
Date: Thu, 9 Mar 2017 23:53:29 +0530	[thread overview]
Message-ID: <CA+T2Sh3ZPWdAAu=6ksJT2h66nYniFDF963-8JSMq_xOTh+ujNA@mail.gmail.com> (raw)
In-Reply-To: <CAFyQvY1m0vmpqpM8QLLnz0fDqyE=FjLq6aaSXR3YC-BZwbJajw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 642 bytes --]

On Thu, Mar 9, 2017 at 10:01 PM, Kaushal Modi <kaushal.modi@gmail.com> wrote:
> This issue seems to be related to the switch bytecode change.

`cond' returns the value of the met condition when the clause doesn't
have a body. That's what seems to be happening when (eq res 'exit).
The result should be t instead of nil. A similar example like:
(defun test (v)
  (cond ((eq v 1) 'one)
((eq v 2))
(t 'none)))
Also displays different results with (test 2) when byte compiled. I've
added a patch to bytecomp.el which tries to fix this, could you apply
it and see whether the issue still exists?

Thanks,
Vibhav

-- 
Vibhav Pant
vibhavp@gmail.com

[-- Attachment #2: condition-only-clause.diff --]
[-- Type: text/plain, Size: 800 bytes --]

diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 25513bd024..068988813a 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -4128,7 +4128,9 @@ byte-compile-cond-jump-table
           ;; depth/tag conflicts or violating asserts down the road.
           ;; To make sure `byte-compile-body' itself doesn't violate this,
           ;; we use `cl-assert'.
-          (byte-compile-body body byte-compile--for-effect)
+          (if (null body)
+              (byte-compile-body '(t) byte-compile--for-effect)
+            (byte-compile-body body byte-compile--for-effect))
           (cl-assert (or (= byte-compile-depth init-depth)
                          (= byte-compile-depth (1+ init-depth))))
           (byte-compile-goto 'byte-goto donetag)

  reply	other threads:[~2017-03-09 18:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-02 23:43 bug#25941: 26.0.50; Different code behavior between using the auto-compiled and evaled versions Kaushal Modi
2017-03-03 12:12 ` Kaushal Modi
2017-03-09 16:31   ` Kaushal Modi
2017-03-09 18:23     ` Vibhav Pant [this message]
2017-03-09 18:28       ` Kaushal Modi
2017-03-09 19:15         ` Kaushal Modi

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='CA+T2Sh3ZPWdAAu=6ksJT2h66nYniFDF963-8JSMq_xOTh+ujNA@mail.gmail.com' \
    --to=vibhavp@gmail.com \
    --cc=25941@debbugs.gnu.org \
    --cc=kaushal.modi@gmail.com \
    --cc=ohwoeowho@gmail.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.
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.