From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: wide-int crash [was Re: [PATCH updated] Support for filesystem watching (inotify)] Date: Wed, 06 Jul 2011 15:31:27 -0700 Organization: UCLA Computer Science Department Message-ID: <4E14E23F.4070507@cs.ucla.edu> References: <201106040034.15598.ruediger@c-plusplus.de> <201106061825.25078.ruediger@c-plusplus.de> <201106240250.01247.ruediger@c-plusplus.de> <4E148534.40106@cs.ucla.edu> <2v8vsbte5m.fsf@fencepost.gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1309991521 27436 80.91.229.12 (6 Jul 2011 22:32:01 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 6 Jul 2011 22:32:01 +0000 (UTC) Cc: 8884@debbugs.gnu.org, Peter Dyballa , emacs-devel@gnu.org To: Glenn Morris Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jul 07 00:31:55 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QeadP-0005Zs-CK for ged-emacs-devel@m.gmane.org; Thu, 07 Jul 2011 00:31:55 +0200 Original-Received: from localhost ([::1]:56935 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QeadO-00083n-8G for ged-emacs-devel@m.gmane.org; Wed, 06 Jul 2011 18:31:54 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:35755) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qead2-00082o-LW for emacs-devel@gnu.org; Wed, 06 Jul 2011 18:31:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qead0-0001gb-OI for emacs-devel@gnu.org; Wed, 06 Jul 2011 18:31:32 -0400 Original-Received: from smtp.cs.ucla.edu ([131.179.128.62]:51879) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qead0-0001gX-6l; Wed, 06 Jul 2011 18:31:30 -0400 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 21BB239E8121; Wed, 6 Jul 2011 15:31:29 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Original-Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LgfcNFuQoYY6; Wed, 6 Jul 2011 15:31:27 -0700 (PDT) Original-Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id B861E39E80F2; Wed, 6 Jul 2011 15:31:27 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Thunderbird/3.1.10 In-Reply-To: <2v8vsbte5m.fsf@fencepost.gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 131.179.128.62 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:141694 Archived-At: On 07/06/11 12:14, Glenn Morris wrote: > http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D8884 Thanks for the heads-up. Although the nearby code has a portability bug regardless of whether --with-wide-int is used, --with-wide-int is more likely to tickle the bug. The bug could well explain the symptoms Peter observed. I committed the following patch into the trunk. Peter, can you please check whether it solves your problem? If not, can you please compile with -g and without -O, and use GDB to report the following values at the point of the crash: buffer_local_flags, idx, offset, sizeof (struct buffer). Thanks. =3D=3D=3D modified file 'src/ChangeLog' --- src/ChangeLog 2011-07-05 09:51:56 +0000 +++ src/ChangeLog 2011-07-06 22:22:32 +0000 @@ -1,3 +1,15 @@ +2011-07-06 Paul Eggert + + Remove unportable assumption about struct layout (Bug#8884). + * alloc.c (mark_buffer): + * buffer.c (reset_buffer_local_variables, Fbuffer_local_variables) + (clone_per_buffer_values): Don't assume that + sizeof (struct buffer) is a multiple of sizeof (Lisp_Object). + This isn't true in general, and it's particularly not true + if Emacs is configured with --with-wide-int. + * buffer.h (FIRST_FIELD_PER_BUFFER, LAST_FIELD_PER_BUFFER): + New macros, used in the buffer.c change. + 2011-07-05 Jan Dj=E4rv =20 * xsettings.c: Use both GConf and GSettings if both are available. =3D=3D=3D modified file 'src/alloc.c' --- src/alloc.c 2011-06-24 21:25:22 +0000 +++ src/alloc.c 2011-07-06 22:22:32 +0000 @@ -5619,7 +5619,8 @@ /* buffer-local Lisp variables start at `undo_list', tho only the ones from `name' on are GC'd normally. */ for (ptr =3D &buffer->BUFFER_INTERNAL_FIELD (name); - (char *)ptr < (char *)buffer + sizeof (struct buffer); + ptr <=3D &PER_BUFFER_VALUE (buffer, + PER_BUFFER_VAR_OFFSET (LAST_FIELD_PER_BUFFER)); ptr++) mark_object (*ptr); =20 =3D=3D=3D modified file 'src/buffer.c' --- src/buffer.c 2011-07-04 15:32:22 +0000 +++ src/buffer.c 2011-07-06 22:22:32 +0000 @@ -471,8 +471,8 @@ =20 /* buffer-local Lisp variables start at `undo_list', tho only the ones from `name' on are GC'd normally. */ - for (offset =3D PER_BUFFER_VAR_OFFSET (undo_list); - offset < sizeof *to; + for (offset =3D PER_BUFFER_VAR_OFFSET (FIRST_FIELD_PER_BUFFER); + offset <=3D PER_BUFFER_VAR_OFFSET (LAST_FIELD_PER_BUFFER); offset +=3D sizeof (Lisp_Object)) { Lisp_Object obj; @@ -830,8 +830,8 @@ =20 /* buffer-local Lisp variables start at `undo_list', tho only the ones from `name' on are GC'd normally. */ - for (offset =3D PER_BUFFER_VAR_OFFSET (undo_list); - offset < sizeof *b; + for (offset =3D PER_BUFFER_VAR_OFFSET (FIRST_FIELD_PER_BUFFER); + offset <=3D PER_BUFFER_VAR_OFFSET (LAST_FIELD_PER_BUFFER); offset +=3D sizeof (Lisp_Object)) { int idx =3D PER_BUFFER_IDX (offset); @@ -1055,8 +1055,8 @@ =20 /* buffer-local Lisp variables start at `undo_list', tho only the ones from `name' on are GC'd normally. */ - for (offset =3D PER_BUFFER_VAR_OFFSET (undo_list); - offset < sizeof (struct buffer); + for (offset =3D PER_BUFFER_VAR_OFFSET (FIRST_FIELD_PER_BUFFER); + offset <=3D PER_BUFFER_VAR_OFFSET (LAST_FIELD_PER_BUFFER); /* sizeof EMACS_INT =3D=3D sizeof Lisp_Object */ offset +=3D (sizeof (EMACS_INT))) { =3D=3D=3D modified file 'src/buffer.h' --- src/buffer.h 2011-06-21 21:32:10 +0000 +++ src/buffer.h 2011-07-06 21:53:56 +0000 @@ -612,6 +612,7 @@ /* Everything from here down must be a Lisp_Object. */ /* buffer-local Lisp variables start at `undo_list', tho only the ones from `name' on are GC'd normally. */ + #define FIRST_FIELD_PER_BUFFER undo_list =20 /* Changes in the buffer are recorded here for undo. t means don't record anything. @@ -846,6 +847,9 @@ t means to use hollow box cursor. See `cursor-type' for other values. */ Lisp_Object BUFFER_INTERNAL_FIELD (cursor_in_non_selected_windows); + + /* This must be the last field in the above list. */ + #define LAST_FIELD_PER_BUFFER cursor_in_non_selected_windows }; =20 =0C