[Matrix-SIG] NumPy core dump

Charles G Waldman cgw@pgt.com
Mon, 21 Dec 1998 16:35:06 -0500 (EST)


Several weeks ago, I wrote:

 > Using Numeric version 1.5, from the LLNLPython6 distribution, on top
 > of Python1.5.2b1, the following piece of code causes a core-dump:
 > 
 > >>>from Numeric import *
 > >>>AM = fromfunction(lambda x:sin(x*pi/512))
 > 
 > I know the code is incorrect (missing second arg. to fromfunction) but
 > shouldn't this raise an exception rather than dumping core?

This behavior is still there in today's 1.7 version.  However I think
it may be due to a compiler bug.  I've been hearing (on the
xemacs-beta mailing list) of a bug in gcc 2.7.2.3 related to register
saving.  Using the "-fno-caller-saves" flag is alleged to work around
this problem.  So, I rebuilt Python1.5.2 and the Numeric extensions
with the -fno-caller-saves option.  Now I get a most peculiar
behavior:  no longer is there an immediate core-dump;  I get 
a TypeError, as expected, but not until after I enter another line.
It doesn't seem to matter if the line is blank or contains
code, as the following examples show:


janus:~> python
Python 1.5.2b1 (#3, Dec 21 1998, 15:59:39)  [GCC 2.7.2.3] on linux2
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> from Numeric import *
>>> AM = fromfunction(lambda x:sin(x*pi/512))
>>> 
TypeError: not enough arguments; expected 2, got 1

janus:~> python
Python 1.5.2b1 (#3, Dec 21 1998, 15:59:39)  [GCC 2.7.2.3] on linux2
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> from Numeric import *
>>> AM = fromfunction(lambda x:sin(x*pi/512))
>>> print AM
TypeError: not enough arguments; expected 2, got 1