emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: address@hidden: RE: emacs 22.1 on hp-ux 11.11 core dumps when DISPLA


From: WAROQUIERS Philippe
Subject: RE: address@hidden: RE: emacs 22.1 on hp-ux 11.11 core dumps when DISPLAY not set]
Date: Thu, 16 Aug 2007 23:00:57 +0200

>Richard Stallman <address@hidden> 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 
>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 
  static vars which are both initialized 
     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 are 
addressed. If you are not the intended recipient, please notify the sender by 
reply and delete the message and any attachments from your system. Any 
unauthorised use or disclosure of the content of this message is strictly 
prohibited and may be unlawful.

Nothing in this e-mail message amounts to a contractual or legal commitment on 
the part of EUROCONTROL, unless it is confirmed by appropriately signed hard 
copy.

Any views expressed in this message are those of the sender.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]