Subject: [[email-masked]: NT Emacs 19.34 crashes in old compiled .elc]

From: Richard Stallman <[email-masked]>
Date: Fri, 13 Sep 1996 19:25:43 -0400

I can't reproduce this--can you?

------- Start of forwarded message -------
Newsgroups: gnu.emacs.bug
Path: news
From: [email-masked] (David Biesack)
Subject: NT Emacs 19.34 crashes in old compiled .elc
Originator: [email-masked]
Sender: [email-masked] (Noter of Newsworthy Events)
Date: Fri, 13 Sep 1996 19:37:25 GMT
Distribution: local
X-Nntp-Posting-Host: mozart.unx.sas.com
Organization: SAS Institute Inc.
Lines: 162
Apparently-To: [email-masked]

GNU Emacs 19.34.1 (i386-*-nt4.0)of Thu Aug 29 1996 
from the cs.washington.edu build.

I have a relatively old compiled .elc file
- -rw-r--r--   1 sasdjb   root        2447 Sep 14  1992 buffer-search.el
which was compiled from Emacs 18.58. Loading this and executing its
M-x buffer-search-regexp in 19.34 on Windows NT 4.0 (final)
causes GNU Emacs to crash. I'm rnning on a 64MB Dell Optiplex GXPro
200 Pentium Pro.

Here is the .el code:

(defvar next-buffer-list nil
  "List of files for next-buffer to process.")

(defun next-buffer (&optional initialize)
  "Select next buffer among files in current buffer list.
Non-nil argument (prefix arg, if interactive)
initializes to the beginning of the list of files in the buffer list."
  (interactive "P")
  (if initialize
      (setq next-buffer-list (buffer-list)))
  (or next-buffer-list
      (error "All files processed."))
  (switch-to-buffer (car next-buffer-list))
  (setq next-buffer-list (cdr next-buffer-list)))

(defvar buffer-loop-form nil
  "Form for buffer-loop-continue to eval to process one file.
If it returns nil, it is through with one file; move on to next.")

(defun buffer-loop-continue (&optional first-time)
  "Continue last \\[buffer-search-regexp] or \\[buffer-query-replace] command.
Used noninteractively with non-nil argument
to begin such a command.  See variable buffer-loop-form."
  (interactive)
  (if first-time
      (progn (next-buffer t)
	     (goto-char (point-min))))
  (while (not (eval buffer-loop-form))
    (next-buffer)
    (message "Scanning file %s..." buffer-file-name)
    (goto-char (point-min)))
  (if (get-buffer-window (current-buffer))
      (select-window (get-buffer-window (current-buffer)))
      (switch-to-buffer (current-buffer))))

(defun buffer-search-regexp (regexp)
  "Search through all files listed in buffer list for match for REGEXP.
Stops when a match is found.
To continue searching for next match, use command \\[buffer-loop-continue]."
  (interactive "sBuffer search (regexp): ")
  (if (and (equal regexp "")
	   (eq (car buffer-loop-form) 're-search-forward))
      (buffer-loop-continue nil)
    (setq buffer-loop-form
	  (list 're-search-forward regexp nil t))
    (buffer-loop-continue t)))

(defun buffer-query-replace (from to &optional delimited)
  "query-replace-regexp FROM with TO through all files listed in buffer list.
Third arg DELIMITED (prefix arg) means replace only word-delimited matches.
If you exit (C-G or ESC), you can resume the query-replace
with the command \\[buffer-loop-continue].

See documentation of variable buffer-file-name."
  (interactive "sBuffer query replace (regexp): \nsBuffer query replace %s by: \nP")
  (setq buffer-loop-form
	(list 'and (list 'save-excursion
			 (list 're-search-forward from nil t))
	      (list 'not (list 'perform-replace from to t t 
			       (not (null delimited))))))
  (buffer-loop-continue t))

8<------8<------8<------8<------8<------8<------8<------8<------8<------

Here is the uuencoded .elc code, which you can also
recreate by compiling the above on GNU Emacs 18.58

8<------8<------8<------8<------8<------8<------8<------8<------8<------

Steps to reproduce:

    put the .el code in a file, C:\temp\bug.el
    put the .elc code in a file, C:\temp\bug.elc
    start emacs 19.34 (via runemacs.exe)
    C-x C-f C:\temp\bug.el
    M-x load-file C:\temp\bug.elc
    M-x buffer-search-regexp defvar ret

Emacs crashes; you get a dialog:

    The instruction at 0x1014e2cf referenced memory at 0xfe2169a9
    The memory could not be "read"

Recompiling the .el file with (setq byte-compile-compatibility t)
solves the problem ... 19.34 loads/executes the new .elc 
(which is quite a bit different) fine. So, this is a pretty
low priority... Are there known problems with the byte code
interpreter handling older byte codes?

I know both the old and the new .elc run fine on:
   GNU Emacs 19.32.1 (hppa1.1-hp-hpux9shr) of Fri Aug  2 1996 on cpusrv04
but I don't have 19.32 on NT or 19.34 on HP/UX to determine
when/where the problem started.

- -- 
David J. Biesack                                    [email-masked]
Object Programming Technology                  (919) 677-8000 ext 7771
SAS Institute Inc. SAS Campus Drive Cary, NC 27513  http://www.sas.com
------- End of forwarded message -------