🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #98781

A suspected bug in unexec.c

#98781
From: Rowland Johnson
Date: Mon, 25 Feb 1991 17:03
65 lines
2333 bytes
  I have a bug that I suspect is being caused by unexec.c. I was hoping
someone might have some insight into this problem before I delve into
it. The relevant facts follow.

    Machine: Sparc 1+
    OS: SunOS 4.0.3 or SunOS4.1 or SunOS4.1.1
    C Compiler and loader: both Sun
    EMACS Version: 18.55

    I have a file with the following structure
	:
	:
int cursor_opened = FALSE;
test_sub()
{
    cursor_opened = FALSE;
  };
	:
	:
DEFUN ("start-db", Fstart_db, Sstart_db, 0, MANY, 0, "T if named database is started")
(nargs, args)
     int nargs;
     Lisp_Object *args;
{
  test_sub();
	:
}
	:
	:
void
syms_of_db ()
{
  test_sub();
	:
}

  Basically, I have arranged that the SAME CODE be executed while
running as temacs and as xemacs. That is, the line

    cursor_opened = FALSE;

inside test_sub gets executed when temacs is being initialized. It also
gets executed when the lisp function (start-db) is evaluated. During the
temacs evaluation things are fine. However, xemacs gets a segmentation
violation on the instruction that stores the value in  cursor_opened. It
would seem that unexec has introduced this problem.

  If the declaration is changed to be uninitialized, i.e.

int cursor_opened;

then the problem goes away. I would assume that the difference is that
cursor_opened is in the BSS instead of data segment now.

  I have seen this problem several times and have managed to get around
it by declaring variables unitialized and setting the value in
syms_of_XXXXX. I have a situation now that I can't realistically do
that.


  Any help, ideas or suggestions would be greatly appreciated. Please
send to 

                                rowland@vogon.llnl.gov
Technical Details
Message-ID: <9102251703.AA05259@vogon.llnl.gov>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!unreplyable!garbage

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,feb904b22df7472e,start
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1991-02-25 09:03:14 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!unreplyable!garbage
From: rowland@VOGON.LLNL.GOV (Rowland Johnson)
Newsgroups: gnu.emacs.bug
Subject: A suspected bug in unexec.c
Message-ID: <9102251703.AA05259@vogon.llnl.gov>
Date: 25 Feb 91 17:03:14 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 65
Approved: bug-gnu-emacs@prep.ai.mit.edu