From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "WAROQUIERS Philippe" Newsgroups: gmane.emacs.devel Subject: RE: [philippe.waroquiers@eurocontrol.int: RE: emacs 22.1 on hp-ux 11.11 core dumps when DISPLAY not set] Date: Thu, 16 Aug 2007 23:00:57 +0200 Message-ID: <1B2B2EF98D55CB41BD16F13B18B9B0080303EE83@FFBRUE001.cfmu.corp.eurocontrol.int> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1187300623 32303 80.91.229.12 (16 Aug 2007 21:43:43 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 16 Aug 2007 21:43:43 +0000 (UTC) Cc: Glenn Morris , emacs-devel@gnu.org To: "Andreas Schwab" , Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Aug 16 23:43:41 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1ILn80-0001vR-CR for ged-emacs-devel@m.gmane.org; Thu, 16 Aug 2007 23:43:40 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ILn7z-0002mx-VX for ged-emacs-devel@m.gmane.org; Thu, 16 Aug 2007 17:43:39 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ILmTD-0006Gq-ST for emacs-devel@gnu.org; Thu, 16 Aug 2007 17:01:31 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ILmTC-0006E5-9c for emacs-devel@gnu.org; Thu, 16 Aug 2007 17:01:31 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ILmTB-0006DU-TX for emacs-devel@gnu.org; Thu, 16 Aug 2007 17:01:30 -0400 Original-Received: from exprod8og51.obsmtp.com ([64.18.3.84]) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1ILmT4-0004Qo-J0; Thu, 16 Aug 2007 17:01:23 -0400 Original-Received: from source ([193.221.170.178]) by exprod8ob51.obsmtp.com ([64.18.7.12]) with SMTP; Thu, 16 Aug 2007 14:01:04 PDT Original-Received: from HHBRUE006.hq.corp.eurocontrol.int (hhbrue006.hq.corp.eurocontrol.int [193.221.160.195]) by ecw.eurocontrol.int (8.12.10/8.12.7) with ESMTP id l7GL0xH3011343; Thu, 16 Aug 2007 23:01:00 +0200 (MEST) Original-Received: from FFBRUE001.cfmu.corp.eurocontrol.int ([193.58.25.50]) by HHBRUE006.hq.corp.eurocontrol.int with Microsoft SMTPSVC(6.0.3790.1830); Thu, 16 Aug 2007 23:00:58 +0200 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message In-Reply-To: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [philippe.waroquiers@eurocontrol.int: RE: emacs 22.1 on hp-ux 11.11 core dumps when DISPLAY not set] Thread-Index: Acffa29Y2o7SpvLoS+6yutmqzirKuwA2Y9fA X-OriginalArrivalTime: 16 Aug 2007 21:00:58.0948 (UTC) FILETIME=[8BB48840:01C7E048] X-Detected-Kernel: Linux 2.6, seldom 2.4 (older, 4) X-Mailman-Approved-At: Thu, 16 Aug 2007 17:43:37 -0400 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:76645 Archived-At: >Richard Stallman writes: > >> In Emacs we don't use static vars at less than file scope. I don't >> 100% remember the reason why. > >See src/s/hpux.h, for example: > >/* USG systems tend to put everything declared static > into the initialized data area, which becomes pure after=20 >dumping Emacs. > Foil this. Emacs carefully avoids static vars inside functions. */ > >#define static > >Andreas. Note that in emacs src directory, doing : grep '^ *static ' *.c finds something like 140 occurences of static vars in functions. (maybe most of these occurences are in some code not used on USG systems ?) Maybe what emacs tries to avoid is=20 static vars which are both initialized=20 and which are then modified during execution. (as unexec on USG systems will transform these vars into pure) Assuming this last reasoning is correct, the bug on hp-ux of emacs-22 can then be explained by: On hp-ux, the #define static in hpux.h means that none of the function local static vars are in fact really static when compiled: they become "normal local vars". Without initialization, a variable (e.g. char *default_orig_pair) has its static keyword removed by the #define above on hpux.h, and gets a random value at function entry (which explains then the core dump). What is not yet clear to me is why the explicit initialization to NULL of the local variables in tty_default_color_capabilities has not solved the core dump problem. Maybe I would need to understand what save/restore is needed for. A thing that could be done to avoid having such a bug (a "written static" in a func) to be re-introduced but still keep static is to always use "static const " inside functions. In such a case, compilation will fail if writing to the static is done inside the function. (by the way, sorry for the "signature" added at the end of the mail. This is done automatically by the company mailing system). ____ This message and any files transmitted with it are legally privileged and= intended for the sole use of the individual(s) or entity to whom they ar= e addressed. If you are not the intended recipient, please notify the sen= der by reply and delete the message and any attachments from your system.= Any unauthorised use or disclosure of the content of this message is str= ictly prohibited and may be unlawful. Nothing in this e-mail message amounts to a contractual or legal commitme= nt on the part of EUROCONTROL, unless it is confirmed by appropriately si= gned hard copy. Any views expressed in this message are those of the sender. =0D