[Python-Dev] troubling math bug under IRIX 6.5

Sjoerd Mullender sjoerd@oratrix.nl
Wed, 14 Feb 2001 14:56:16 +0100


As an extra datapoint:

I just tried this (4 * math.exp(-0.5)) on my SGI O2 and on our SGI
file server with the current CVS version of Python, compiled with -O.
I don't get a crash.

I am running IRIX 6.5.10m on the O2 and 6.5.2m on the server.  What
version are you running?

On Tue, Feb 13 2001 Flying Cougar Burnette wrote:

> Tim Peters writes:
> |
> | > now neither does.  shall I turn opts back on and try a few more
> | > cases?
> | 
> | Yes, please, one more:
> | 
> |     4.0 * 3.1
> | 
> | Or, if that works, go back to the failing
> | 
> |     4.0 * math.exp(-0.5)
> 
> both of these work, but changing the 4.0 to an integer 4 produces the
> bus error.  so it is definitely a conversion to double/float thats
> the problem.
> 
> | 
> | In any failing case, can you jump into a debubber and get a stack trace?
> 
> sure.  I've included an entire dbx session at the end of this mail.
> 
> | 
> | Do you happen to have
> | 
> |     WANT_SIGFPE_HANDLER
> | 
> | #define'd when you compile Python on this platform?  If so, it complicates
> | the code a lot.  I wonder about that because you got a "bus error", and when
> | WANT_SIGFPE_HANDLER is #defined we get a whole pile of ugly setjmp/longjmp
> | code that doesn't show up on my box.
> 
> a peek at config.h shows the WANT_SIGFPE_HANDLER define commented
> out.  should I turn it on and see what happens?
> 
> 
> | 
> | Another tack, as a temporary workaround:  try disabling optimization only
> | for Objects/floatobject.c.  That will probably fix the problem, and if so
> | that's enough of a workaround to get you unstuck while pursuing these other
> | irritations.
> 
> this one works just fine.  workarounds aren't a problem for me right
> now since I'm in no hurry to get this version in use here.  I'm just
> trying to help debug this version for irix users in general.
> 
> 
> ------------%< snip %<----------------------%< snip %<------------
> 
> (tommy@mace)/u0/tommy/pycvs/python/dist/src$ dbx python
> dbx version 7.3 65959_Jul11 patchSG0003841 Jul 11 2000 02:29:30
> Executable /usr/u0/tommy/pycvs/python/dist/src/python
> (dbx) run
> Process 563746 (python) started
> Python 2.1a2 (#6, Feb 13 2001, 17:43:32) [C] on irix6
> Type "copyright", "credits" or "license" for more information.
> >>> 3 * 4.0
> 12.0
> >>> import math
> >>> 4 * math.exp(-.5)
> Process 563746 (python) stopped on signal SIGBUS: Bus error (default) at [float_mul:383 +0x4,0x1004c158]
>  383  CONVERT_TO_DOUBLE(v, a);
> (dbx) l
> >* 383          CONVERT_TO_DOUBLE(v, a);
>    384          CONVERT_TO_DOUBLE(w, b);
>    385          PyFPE_START_PROTECT("multiply", return 0)
>    386          a = a * b;
>    387          PyFPE_END_PROTECT(a)
>    388          return PyFloat_FromDouble(a);
>    389  }
>    390  
>    391  static PyObject *
>    392  float_div(PyObject *v, PyObject *w)
> (dbx) t
> >  0 float_mul(0x100b69fc, 0x10116788, 0x8, 0x100a1318, 0x10050000, 0x10116788, 0x100a1318, 0x100a1290) ["/usr/u0/tommy/pycvs/python/dist/src/Objects/floatobject.c":383, 0x1004c158]
>    1 binary_op1(0x100b69fc, 0x10116788, 0x0, 0x100a1318, 0x10050000, 0x10116788, 0x100a1318, 0x100a1290) ["/usr/u0/tommy/pycvs/python/dist/src/Objects/abstract.c":337, 0x1003ac5c]
>    2 binary_op(0x100b69fc, 0x10116788, 0x8, 0x0, 0x10050000, 0x10116788, 0x100a1318, 0x100a1290) ["/usr/u0/tommy/pycvs/python/dist/src/Objects/abstract.c":373, 0x1003ae70]
>    3 PyNumber_Multiply(0x100b69fc, 0x10116788, 0x8, 0x100a1318, 0x10050000, 0x10116788, 0x100a1318, 0x100a1290) ["/usr/u0/tommy/pycvs/python/dist/src/Objects/abstract.c":544, 0x1003b5a4]
>    4 eval_code2(0x1012c688, 0x0, 0xffffffec, 0x0, 0x0, 0x0, 0x0, 0x0) ["/usr/u0/tommy/pycvs/python/dist/src/Python/ceval.c":896, 0x10034a54]
>    5 PyEval_EvalCode(0x100b69fc, 0x10116788, 0x8, 0x100a1318, 0x10050000, 0x10116788, 0x100a1318, 0x100a1290) ["/usr/u0/tommy/pycvs/python/dist/src/Python/ceval.c":336, 0x10031768]
>    6 run_node(0x100f88c0, 0x10116788, 0x0, 0x0, 0x10050000, 0x10116788, 0x100a1318, 0x100a1290) ["/usr/u0/tommy/pycvs/python/dist/src/Python/pythonrun.c":931, 0x10040444]
>    7 PyRun_InteractiveOne(0x0, 0x100b1878, 0x8, 0x100a1318, 0x10050000, 0x10116788, 0x100a1318, 0x100a1290) ["/usr/u0/tommy/pycvs/python/dist/src/Python/pythonrun.c":540, 0x1003f1f0]
>    8 PyRun_InteractiveLoop(0xfb4a398, 0x100b1878, 0x8, 0x100a1318, 0x10050000, 0x10116788, 0x100a1318, 0x100a1290) ["/usr/u0/tommy/pycvs/python/dist/src/Python/pythonrun.c":486, 0x1003ef84]
>    9 PyRun_AnyFileEx(0xfb4a398, 0x100b1878, 0x0, 0x100a1318, 0x10050000, 0x10116788, 0x100a1318, 0x100a1290) ["/usr/u0/tommy/pycvs/python/dist/src/Python/pythonrun.c":461, 0x1003eeac]
>    10 Py_Main(0x1, 0x0, 0x8, 0x100a1318, 0x10050000, 0x10116788, 0x100a1318, 0x100a1290) ["/usr/u0/tommy/pycvs/python/dist/src/Modules/main.c":292, 0x1000bba4]
>    11 main(0x100b69fc, 0x10116788, 0x8, 0x100a1318, 0x10050000, 0x10116788, 0x100a1318, 0x100a1290) ["/usr/u0/tommy/pycvs/python/dist/src/Modules/python.c":10, 0x1000b7bc]
> More (n if no)?y
>    12 __start() ["/xlv55/kudzu-apr12/work/irix/lib/libc/libc_n32_M4/csu/crt1text.s":177, 0x1000b558]
> (dbx) 
> 
> _______________________________________________
> Python-Dev mailing list
> Python-Dev@python.org
> http://mail.python.org/mailman/listinfo/python-dev
> 

-- Sjoerd Mullender <sjoerd.mullender@oratrix.com>