From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: RE: [drew.adams@oracle.com: RE: weird defadvicebugwithbyte-compilation] Date: Mon, 12 Dec 2005 19:52:37 -0800 Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1134446039 20569 80.91.229.2 (13 Dec 2005 03:53:59 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 13 Dec 2005 03:53:59 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Dec 13 04:53:58 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Em1Dj-0006rp-5C for ged-emacs-devel@m.gmane.org; Tue, 13 Dec 2005 04:52:55 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Em1EF-0001CW-Bf for ged-emacs-devel@m.gmane.org; Mon, 12 Dec 2005 22:53:27 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Em1E3-0001CG-Tc for emacs-devel@gnu.org; Mon, 12 Dec 2005 22:53:15 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Em1E3-0001C4-7d for emacs-devel@gnu.org; Mon, 12 Dec 2005 22:53:15 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Em1E3-0001C1-43 for emacs-devel@gnu.org; Mon, 12 Dec 2005 22:53:15 -0500 Original-Received: from [141.146.126.228] (helo=agminet01.oracle.com) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1Em1Fs-00061k-Go for emacs-devel@gnu.org; Mon, 12 Dec 2005 22:55:08 -0500 Original-Received: from rgmsgw301.us.oracle.com (rgmsgw301.us.oracle.com [138.1.186.50]) by agminet01.oracle.com (Switch-3.1.7/Switch-3.1.7) with ESMTP id jBD4AcNK012110 for ; Mon, 12 Dec 2005 22:10:39 -0600 Original-Received: from rgmsgw301.us.oracle.com (localhost [127.0.0.1]) by rgmsgw301.us.oracle.com (Switch-3.1.7/Switch-3.1.7) with ESMTP id jBD3qdRj019286 for ; Mon, 12 Dec 2005 20:52:39 -0700 Original-Received: from dradamslap (dhcp-amer-rmdc-csvpn-gw4-141-144-96-242.vpn.oracle.com [141.144.96.242]) by rgmsgw301.us.oracle.com (Switch-3.1.7/Switch-3.1.7) with SMTP id jBD3qcpN019272 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) for ; Mon, 12 Dec 2005 20:52:39 -0700 Original-To: X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) In-Reply-To: Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 X-Brightmail-Tracker: AAAAAQAAAAI= X-Whitelist: TRUE X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:47604 Archived-At: Please see my previous emails, where I describe the original case (which uses define-minor-mode). Could you send that test case again? Not sure what you want. Below is the test case again. It is self-contained for reproducing the crash bug (on Windows). Are you perhaps asking about the define-minor-mode questions, or is this what you wanted? -------------------8<---------------------------------- -----Original Message----- From: Drew Adams [mailto:drew.adams@oracle.com] Sent: Monday, November 14, 2005 4:33 PM To: Emacs-Pretest-Bug Subject: weird defadvice bug with byte-compilation Importance: High This is a weird one. I've pared it down to the bare bones, I think - if I comment out any part of this, the bug doesn't occur. This obviously comes from a larger context - when it is pared down, the code doesn't make much sense, of course. If the stuff is in the same file, or the order is different, no bug (error). It must be like this: two files, one of which is compiled and required by the other. And the requiring file must have "compile" in its defadvice. Two files: File 1: foo.el -------------- (defvar mymap nil "") (let ((map (make-sparse-keymap "II"))) (setq mymap (make-sparse-keymap)) (define-key menu-bar-search-menu [ise] '("" . ise)) (put 'ise 'menu-enable '(and my-mode)) (push (cons 'my-mode mymap) minor-mode-map-alist)) (defadvice next-history-element (after ffff activate) "" my-mode) (provide 'foo) File 2: bar.el -------------- (defconst special-display-regexps '("[ ]?[*][^*]+[*]")) (defvar drews-lisp-dir "C:\\drews-lisp-20" "") (setq load-path (append (list drews-lisp-dir) load-path)) (defadvice occur-mode-goto-occurrence (around jjjjjj activate compile) "" ad-do-it) (require 'foo) Instructions: ------------- 1. emacs -q 2. Byte-compile foo.el (it doesn't matter if it's compiled on Emacs 20 or 22). `C-x C-c'. 3. emacs -q (Emacs 22) 4. Visit bar.el - don't load it. 5. Select everything in bar.el except the (require 'foo), and do `eval-region'. 6. Put the cursor just after the (require 'foo) and do `C-x C-e'. (Don't select it and do eval-region - that doesn't produce the bug!) You will get this error backtrace: Debugger entered--Lisp error: (void-variable my-mode) (and my-mode) x-create-frame(((visibility) (height . 14) (width . 80) (unsplittable . t))) x-create-frame-with-faces(((height . 14) (width . 80) (unsplittable . t))) make-frame(((height . 14) (width . 80) (unsplittable . t))) special-display-popup-frame(#) display-buffer(#) display-warning(bytecomp "reference to free variable `my-mode'" :warning "*Compile-Log*") byte-compile-log-warning("reference to free variable `my-mode'" t :warning) byte-compile-warn("reference to free variable `%s'" my-mode) byte-compile-variable-ref(byte-varref my-mode) byte-compile-form(my-mode t) byte-compile-body(((setq ad-return-value (ad-Orig-next-history-element n)) my-mode ad-return-value) nil) byte-compile-let((let (ad-return-value) (setq ad-return-value (ad-Orig-next-history-element n)) my-mode ad-return-value)) byte-compile-form((let (ad-return-value) (setq ad-return-value (ad-Orig-next-history-element n)) my-mode ad-return-value) nil) byte-compile-top-level((progn (let (ad-return-value) (setq ad-return-value ...) my-mode ad-return-value)) nil lambda) byte-compile-lambda((lambda (n) "$ad-doc: next-history-element$" (interactive "p") (let (ad-return-value) (setq ad-return-value ...) my-mode ad-return-value))) #[nil "??? \n \f ?? 7. `C-x C-c' You will get a pop-up message with Yes/No buttons that says this: Emacs Abort Dialog "A fatal error has occurred! Would you like to attach a debugger? Select YES to debu, NO to abort Emacs" If you select Yes, you get a Window program exception and an invitation to send the details to Microsoft. The error report contents are these: Exception Information Code 0x80000003 Flags: 0x00000000 Record: 0x0000000000000000 (didn't count 'em) Address: 0x0000000077f75a58 System Information Windows NT 5.1 Build: 2600 CPU Vendor Code etc. blah blah blah Module 1 emacs.exe blah blah Module 2 ntdll.dll blah blah Module 3 kernel32.dll blah blah Module 4 msvcrt.dll blah blah etc. etc. ------------------------------------ In GNU Emacs 22.0.50.1 (i386-mingw-nt5.1.2600) of 2005-06-26 on NONIQPC X server distributor `Microsoft Corp.', version 5.1.2600 configured using `configure --with-gcc (3.3) --cflags -I../../jpeg-6b-3/include -I../../libpng-1.2.8/include -I../../tiff-3.6.1-2/include -I../../xpm-nox-4.2.0/include -I../../zlib-1.2.2/include'