Subject: bug#26518: 26.0.50; M-x bubbles crashes emacs

From: Vibhav Pant <[email-masked]>
Date: Sun, 16 Apr 2017 20:26:27 +0530

The following code also crashes Emacs:
(defun fun1 (v)
  (car (cond ((eq v 1) '(one . 1))
    ((eq v 2) '(two . 2))
    ((eq v 3) '(three . 3)))))
(byte-compile 'fun1)
(defun fun2 (v)
  (inline (fun1 v)))
(byte-compile 'fun2)
(fun2 1)

The problem lies in byte-compile-inline-lapcode not being able to
inline bytecode that uses switch, because the peephole optimizer
will often merge tags and convert goto-to-return to returns,
making it impossible restore the correct byte-compile-depth while
inlining it. I can think of two ways to fix this:

Disable certain optimizations for byte-switch code, and allow
the jump table to store certain properties that will make it possible
to inline switch code properly (specifically, the donetag). This could
be done by replacing the hash table with a (DONETAG . JUMP-TABLE) cons
pair (inline-lapcode would use the car, while the bytecode VM would use
it's cdr).

Disable inlining byte-switch code entirely. However, this would impact
performance negatively.

Thoughts?

Regards,
Vibhav

-- 
Vibhav Pant
[email-masked]