[Python-bugs-list] [ python-Bugs-478291 ] 1./4 -> core on IRIX

noreply@sourceforge.net noreply@sourceforge.net
Mon, 05 Nov 2001 11:23:13 -0800


Bugs item #478291, was opened at 2001-11-05 05:39
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=478291&group_id=5470

Category: Python Interpreter Core
>Group: Platform-specific
>Status: Closed
>Resolution: Duplicate
Priority: 5
Submitted By: Dirk Reiners (dirk)
>Assigned to: Tim Peters (tim_one)
Summary: 1./4 -> core on IRIX

Initial Comment:
We're using Version 2.1.1 on sgi Irix, and the math routines dump core a lot when mixing float and integer numbers. Interestingly enough the effect depends on the actual values of the numbers:





tizian: scratch/Python-2.1.1 313 % ./python


Python 2.1.1 (#1, Nov  5 2001, 13:34:04) [C] on irix646


Type "copyright", "credits" or "license" for more information.


>>> 1./3


0.33333333333333331


>>> 1./5


0.20000000000000001


>>> 1./4


Bus error (core dumped)





Or, a little different:





tizian: scratch/Python-2.1.1 315 % ./python


Python 2.1.1 (#1, Nov  5 2001, 13:34:04) [C] on irix646


Type "copyright", "credits" or "license" for more information.


>>> from math import sin


>>> 15*sin(8)


14.840373699350726


>>> 17*sin(8)


16.819090192597489


>>> 16*sin(8)


Bus error (core dumped)





Interestingly enough that only happens with the optimized version, not with the debug version (which makes debugging a little difficult :( ).





The stack for the 1./4 case looks like this:





>  0 float_div(0x101a9b48, 0x10149e64, 0xc, 0x101416dc, 0x100550d0, 0x100f4460, 0x100f44d0, 0x1) ["/igd/a4/scratch/reiners/Python-2.1.1/Objects/floatobject.c":394, 0x1005561c]


   1 binary_op1(0x101a9b48, 0x10149e64, 0x0, 0x101416dc, 0x100550d0, 0x100f4460, 0x100f44d0, 0x1) ["/igd/a4/scratch/reiners/Python-2.1.1/Objects/abstract.c":324, 0x100424a4]


   2 binary_op(0x101a9b48, 0x10149e64, 0xc, 0x0, 0x100550d0, 0x100f4460, 0x100f44d0, 0x1) ["/igd/a4/scratch/reiners/Python-2.1.1/Objects/abstract.c":373, 0x10042730]


   3 PyNumber_Divide(0x101a9b48, 0x10149e64, 0xc, 0x101416dc, 0x100550d0, 0x100f4460, 0x100f44d0, 0x1) ["/igd/a4/scratch/reiners/Python-2.1.1/Objects/abstract.c":545, 0x10042ea4]


   4 eval_code2(0x1015b110, 0x0, 0x0, 0x0, 0x1014d949, 0x0, 0x0, 0x0) ["/igd/a4/scratch/reiners/Python-2.1.1/Python/ceval.c":955, 0x1003c10c]


   5 PyEval_EvalCode(0x101a9b48, 0x10149e64, 0xc, 0x101416dc, 0x100550d0, 0x100f4460, 0x100f44d0, 0x1) ["/igd/a4/scratch/reiners/Python-2.1.1/Python/ceval.c":341, 0x10038cd8]


   6 run_node(0x10148c90, 0x10149e64, 0x0, 0x0, 0x100550d0, 0x100f4460, 0x100f44d0, 0x1) ["/igd/a4/scratch/reiners/Python-2.1.1/Python/pythonrun.c":1045, 0x10048618]


   7 PyRun_InteractiveOneFlags(0x0, 0x101410f8, 0x0, 0x101416dc, 0x100550d0, 0x100f4460, 0x100f44d0, 0x1) ["/igd/a4/scratch/reiners/Python-2.1.1/Python/pythonrun.c":570, 0x10047048]


   8 PyRun_InteractiveLoopFlags(0xfb4a520, 0x101410f8, 0x7fff2e30, 0x101416dc, 0x100550d0, 0x100f4460, 0x100f44d0, 0x1) ["/igd/a4/scratch/reiners/Python-2.1.1/Python/pythonrun.c":510, 0x10046d88]


   9 PyRun_AnyFileExFlags(0xfb4a520, 0x101410f8, 0x0, 0x0, 0x100550d0, 0x100f4460, 0x100f44d0, 0x1) ["/igd/a4/scratch/reiners/Python-2.1.1/Python/pythonrun.c":473, 0x10046c68]


   10 Py_Main(0x1, 0x0, 0xc, 0x101416dc, 0x100550d0, 0x100f4460, 0x100f44d0, 0x1) ["/igd/a4/scratch/reiners/Python-2.1.1/Modules/main.c":320, 0x10012458]


   11 main(0x101a9b48, 0x10149e64, 0xc, 0x101416dc, 0x100550d0, 0x100f4460, 0x100f44d0, 0x1) ["/igd/a4/scratch/reiners/Python-2.1.1/Modules/python.c":10, 0x100120ac]


   12 __start() ["/xlv55/kudzu-apr12/work/irix/lib/libc/libc_n32_M4/csu/crt1text.s":177, 0x10012058]





It happens here:





   390  static PyObject *


   391  float_div(PyObject *v, PyObject *w)


   392  {


   393          double a,b;


>* 394          CONVERT_TO_DOUBLE(v, a);


   395          CONVERT_TO_DOUBLE(w, b);





Just compiling floatobject.c without -O makes it work, but that's not really a solution.




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

>Comment By: Tim Peters (tim_one)
Date: 2001-11-05 11:23

Message:
Logged In: YES 
user_id=31435

Closed as Duplicate; see bug 435026 for details.  It's an 
optimization bug in the SGI compiler.  You should ask SGI 
for a compiler fix.  Over the years we've had so many -O 
problems on SGI that Python's main README file has long 
suggested turning off optimization on SGI in case of any 
strange behavior on that platform.

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

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=478291&group_id=5470