Segmentation violation on running scripts


To ng-spice mailing list <ng-spice@ieee.ing.uniroma1.it>
From Robert Penny <rob@network.ucsd.edu>
Date Tue, 9 Jan 2001 13:51:46 -0800 (PST)
Delivered-To mailing list ng-spice@ieee.ing.uniroma1.it
Mailing-List contact ng-spice-help@ieee.ing.uniroma1.it; run by ezmlm
Reply-To ng-spice@ieee.ing.uniroma1.it

I've been carrying on a bit of a discussion with Michael regarding the
error I get when attempting to run scripts on ng-spice-rework-13.  I have
a workaround, so it's not a big deal... but I thought I'd post it to the
mailing list so it can be in people's minds during the next rework.

The basic problem is when I attempt to run any script, even a very simple
one such as

-------------- cut here ---------------
* Output a test text string
.control
echo "Hi there, world"
.endc
-------------- cut here ---------------

I get the error message

internal error -- segmentation violation

I discovered that not all compiled versions of ng-spice exhibit the
problem.  In fact I found today that it is only the versions of ng-spice
that are compiled without the garbage collecting malloc that have
the problem.

To isolate the problem I did two builds of ng-spice-rework-13... one
configured with ac_cv_lib_gc_GC_malloc=yes and one =no.

(Specifically I copied the source tree of ng-spice-rework-13 to
ng-spice-rework-13-nogc.  I then hid /usr/local/include/gc and
/usr/local/lib/libgc.so, ran ldconfig, did a distclean at the top of the
ng-spice source tree, did a ./configure and then a make.  A diff on
config.cache in the two source trees shows the only differences in the
autoconfigs to be the ac_cv_lib_gc_GC_malloc line.)

Below is the output of attempting to run my echo script (called testit) 
with gc and without gc.  Other than that, these are identical builds on
the same machine.  I'm running on a Linux Mandrake installation, using gcc
version 2.95.2 and glibc version 2.1.2-9.

------------------- Screen capture ---------------

[rob@rb-rob radsmart]$ /usr/src/tarballs/ng-spice-rework-13-nogc/src/ngspice
Note: can't find init file.
******
** ngspice-13 : Circuit level simulation program
** The U. C. Berkeley CAD Group
** Copyright 1985-1994, Regents of the University of California.
** Please submit bug-reports to: ng-spice-bugs@ieee.ing.uniroma1.it
** Creation Date: Tue Jan  9 10:59:27 PST 2001
******
ngspice 1 -> testit

internal error -- segmentation violation
[rob@rb-rob radsmart]$ /usr/src/tarballs/ng-spice-rework-13/src/ngspice
Note: can't find init file.
******
** ngspice-13 : Circuit level simulation program
** The U. C. Berkeley CAD Group
** Copyright 1985-1994, Regents of the University of California.
** Please submit bug-reports to: ng-spice-bugs@ieee.ing.uniroma1.it
** Creation Date: Tue Jan  9 11:35:11 PST 2001
******
ngspice 1 -> testit
Hi there, world.
ngspice 2 -> quit
ngspice-13 done

--------------------------------------------------

So... a simple work around, use GC_malloc.  Still, it would be interesting
to know where lack of GC_malloc is causing a problem.

-Rob Penny (rob@ucsd.edu)


Partial thread listing: