This looks like an Emacs bug. Reduced reproducer:
$ cat repro.el
(defsubst bar (a &rest b) nil)
(defun foo () (bar 1 2 3 4))
$ emacs -Q --batch -f batch-byte-compile repro.el
In toplevel form:
repro.el:2:2: Error: Optimizer error: too much on the stack
I'll see if I can make some workaround.
-- Joel

