Python 2.1 on SGI

RajGopal Srinivasan raj at grserv.med.jhmi.edu
Tue May 15 22:27:36 CEST 2001


	Curiously, one can compile with optimization and not have a SIGBUS if
the CONVERT_TO_DOUBLE macro is slightly modified as follows:

*** floatobject.c       Tue May 15 16:24:01 2001
--- floatobject.c.orig  Tue May 15 16:22:56 2001
***************
*** 261,271 ****
     slot function */
  
  #define CONVERT_TO_DOUBLE(obj, dbl)                   \
!       if (PyFloat_Check(obj)) {                       \
!               Py_INCREF(obj);                         \
                dbl = PyFloat_AS_DOUBLE(obj);           \
-               Py_DECREF(obj);                         \
-       }                                               \
        else if (convert_to_double(&(obj), &(dbl)) < 0) \
                return obj;
  
--- 261,268 ----
     slot function */
  
  #define CONVERT_TO_DOUBLE(obj, dbl)                   \
!       if (PyFloat_Check(obj))                         \
                dbl = PyFloat_AS_DOUBLE(obj);           \
        else if (convert_to_double(&(obj), &(dbl)) < 0) \
                return obj;


raj

Randall Hopper wrote:
> 
>      Just to FYI to save others some trouble.  When compiling Python 2.1 on
> SGI with optimization enabled, you'll probably need to compile
> Objects/floatobject.c with -O0 to work around a MIPSPro compiler
> optimization bug.  A symptom if you don't is a SIGBUS in floatobject.c
> float_div() line 394:
> 
>         static PyObject *
>         float_div(PyObject *v, PyObject *w)
>         {
>                 double a,b;
>                 CONVERT_TO_DOUBLE(v, a);           <------------
>                 CONVERT_TO_DOUBLE(w, b);
> 
> This is IRIX 6.5 with MIPSPro 7.3.1.1m BTW.
> 
> Randall
> 
> --
> Randall Hopper
> aa8vb at yahoo.com



More information about the Python-list mailing list