From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Antipov Newsgroups: gmane.emacs.bugs Subject: bug#16986: Fw: Re: Crash when idle Date: Fri, 01 Aug 2014 12:17:31 +0400 Message-ID: <53DB4D1B.5070004@yandex.ru> References: <53346B1E.1010902@cs.ucla.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------070405010607090704080302" X-Trace: ger.gmane.org 1406881105 11950 80.91.229.3 (1 Aug 2014 08:18:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 1 Aug 2014 08:18:25 +0000 (UTC) Cc: Simon Carter , 16986@debbugs.gnu.org To: YAMAMOTO Mitsuharu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Aug 01 10:18:19 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XD82d-0003F2-8v for geb-bug-gnu-emacs@m.gmane.org; Fri, 01 Aug 2014 10:18:19 +0200 Original-Received: from localhost ([::1]:60446 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XD82c-0007BF-E9 for geb-bug-gnu-emacs@m.gmane.org; Fri, 01 Aug 2014 04:18:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45873) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XD82T-0007A8-1n for bug-gnu-emacs@gnu.org; Fri, 01 Aug 2014 04:18:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XD82M-0002hx-Ti for bug-gnu-emacs@gnu.org; Fri, 01 Aug 2014 04:18:08 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:46671) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XD82M-0002hp-MZ for bug-gnu-emacs@gnu.org; Fri, 01 Aug 2014 04:18:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XD82M-0006xy-4x for bug-gnu-emacs@gnu.org; Fri, 01 Aug 2014 04:18:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Antipov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 01 Aug 2014 08:18:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16986 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 16986-submit@debbugs.gnu.org id=B16986.140688107726762 (code B ref 16986); Fri, 01 Aug 2014 08:18:01 +0000 Original-Received: (at 16986) by debbugs.gnu.org; 1 Aug 2014 08:17:57 +0000 Original-Received: from localhost ([127.0.0.1]:53614 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XD82G-0006xX-6p for submit@debbugs.gnu.org; Fri, 01 Aug 2014 04:17:56 -0400 Original-Received: from forward9l.mail.yandex.net ([84.201.143.142]:39060) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XD82D-0006xK-UU for 16986@debbugs.gnu.org; Fri, 01 Aug 2014 04:17:55 -0400 Original-Received: from smtp16.mail.yandex.net (smtp16.mail.yandex.net [95.108.252.16]) by forward9l.mail.yandex.net (Yandex) with ESMTP id 3EBC1E62325; Fri, 1 Aug 2014 12:17:47 +0400 (MSK) Original-Received: from smtp16.mail.yandex.net (localhost [127.0.0.1]) by smtp16.mail.yandex.net (Yandex) with ESMTP id B5BCC6A02D6; Fri, 1 Aug 2014 12:17:46 +0400 (MSK) Original-Received: from 167.gprs.mts.ru (167.gprs.mts.ru [213.87.138.167]) by smtp16.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 5b5JrxciOy-HjDKMF8d; Fri, 1 Aug 2014 12:17:45 +0400 (using TLSv1.2 with cipher AES128-SHA (128/128 bits)) (Client certificate not present) X-Yandex-Uniq: cdb98acb-ddc7-4512-88bc-914c60416d3a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1406881066; bh=9w1Z9vlTnLQiiq6BNxwi4Lj4/taYnE5fv9drFBnmjxQ=; h=Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: References:In-Reply-To:Content-Type; b=mdaxLjD5hn6TRVBzbb+/o32DZw4C6IakAGk6PN6wgJCLnPKFTefUWFvmk2mTgL5Zz XouuBC2SQAg+4LvTB2/ehX2Zdd9KZ866jv00fhbQ5g9kWtikfJhdjAlJ0o8IWCzIty uoE49c+7vUH4lP8M8rg0XrqyvDJLB8yV9THIagkY= Authentication-Results: smtp16.mail.yandex.net; dkim=pass header.i=@yandex.ru User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:92021 Archived-At: This is a multi-part message in MIME format. --------------070405010607090704080302 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit On 07/23/2014 02:09 PM, YAMAMOTO Mitsuharu wrote: > I suspect there are no direct references to the value of `directory' > from stack contents or register values, and thus GC triggered by the > above DECODE_FILE has collected the value of `directory' as a garbage. > If that is the case, %rax at <+730> (i.e., &XSTRING(directory)->data) > would become invalid. Nice shot. Clang 3.4 with -O2 -g3 generates: 0x0000000000531c21 <+721>: callq 0x551570 0x0000000000531c26 <+726>: mov %rax,%rbp 0x0000000000531c29 <+729>: mov 0x17(%rbp),%rdi 0x0000000000531c2d <+733>: mov 0x28(%rsp),%rax 0x0000000000531c32 <+738>: mov (%rax),%rsi 0x0000000000531c35 <+741>: mov 0x38(%rsp),%rdx 0x0000000000531c3a <+746>: callq 0x413050 GCC 4.8.3 with -O2 -g3 generates: 0x0000000000520e0d <+573>: callq 0x5407e0 0x0000000000520e12 <+578>: mov 0x38(%rsp),%rsi 0x0000000000520e17 <+583>: lea -0x1(%rax),%r15 0x0000000000520e1b <+587>: mov 0x20(%rsp),%rdx 0x0000000000520e20 <+592>: mov 0x18(%r15),%rdi 0x0000000000520e24 <+596>: mov %rax,%rbx 0x0000000000520e27 <+599>: mov 0x18(%rsi),%rsi 0x0000000000520e2b <+603>: callq 0x413270 With an attached patch, clang generates: 0x0000000000531c01 <+689>: callq 0x551560 0x0000000000531c06 <+694>: mov 0x17(%rax),%rdi 0x0000000000531c0a <+698>: mov %rax,%rbp 0x0000000000531c0d <+701>: mov 0x68(%rsp),%rax 0x0000000000531c12 <+706>: mov 0x17(%rax),%rsi 0x0000000000531c16 <+710>: mov 0x50(%rsp),%rdx 0x0000000000531c1b <+715>: callq 0x413050 I.e. with a displacement to %rsi. OK to install? Dmitry --------------070405010607090704080302 Content-Type: text/x-patch; name="bug16986.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="bug16986.patch" === modified file 'src/dired.c' --- src/dired.c 2014-04-16 19:43:46 +0000 +++ src/dired.c 2014-08-01 08:11:30 +0000 @@ -133,7 +133,7 @@ In the latter case, ID_FORMAT is passed to Ffile_attributes. */ Lisp_Object -directory_files_internal (Lisp_Object directory, Lisp_Object full, +directory_files_internal (Lisp_Object dir, Lisp_Object full, Lisp_Object match, Lisp_Object nosort, bool attrs, Lisp_Object id_format) { @@ -149,6 +149,16 @@ #ifdef WINDOWSNT Lisp_Object w32_save = Qnil; #endif +#ifdef __clang__ + /* It is suspected that clang (as of 3.4 running with -O2) can + optimize DIR away so there is no reference from C stack to + this object. Since this can crash GC, we're using volatile + variable to disable such an optimization. For details, see + http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16986#32. */ + volatile Lisp_Object directory = dir; +#else + Lisp_Object directory = dir; +#endif /* Because of file name handlers, these functions might call Ffuncall, and cause a GC. */ --------------070405010607090704080302--