From: "WAROQUIERS Philippe" <philippe.waroquiers@eurocontrol.int>
To: "Andreas Schwab" <schwab@suse.de>, <rms@gnu.org>
Cc: Glenn Morris <rgm@gnu.org>, emacs-devel@gnu.org
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 [thread overview]
Message-ID: <1B2B2EF98D55CB41BD16F13B18B9B0080303EE83@FFBRUE001.cfmu.corp.eurocontrol.int> (raw)
In-Reply-To: <je3ayky775.fsf@sykes.suse.de>
>Richard Stallman <rms@gnu.org> 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.
next prev parent reply other threads:[~2007-08-16 21:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-09 23:11 [philippe.waroquiers@eurocontrol.int: RE: emacs 22.1 on hp-ux 11.11 core dumps when DISPLAY not set] Richard Stallman
2007-08-15 2:43 ` Glenn Morris
2007-08-15 2:46 ` Glenn Morris
[not found] ` <E1ILNVk-0007Gh-IH@fencepost.gnu.org>
2007-08-15 18:38 ` Andreas Schwab
2007-08-16 21:00 ` WAROQUIERS Philippe [this message]
2007-08-17 4:49 ` Richard Stallman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1B2B2EF98D55CB41BD16F13B18B9B0080303EE83@FFBRUE001.cfmu.corp.eurocontrol.int \
--to=philippe.waroquiers@eurocontrol.int \
--cc=emacs-devel@gnu.org \
--cc=rgm@gnu.org \
--cc=rms@gnu.org \
--cc=schwab@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.