Hi,

ticket #654 describes a problem with the order in which function call 
arguments are evaluated. I fixed it and it broke Sage.

The problem was that in cases where some arguments are simple and others 
are not, the non-simple arguments are stuffed into a temp before hand, thus 
being evaluated before the other arguments. This can break side-effects of 
simple arguments, which include C function calls.

My fix was to put all arguments into temps if any of them are in temps 
anyway. However, there is this code in Sage (wrapper_rr.pyx/.pxd):

   cdef class Wrapper_rr(Wrapper):
       cdef int _n_args
       cdef mpfr_t* _args
       ...

   # offending line:
   mpfr_init2(self._args[i], self.domain.prec())

The signature of mpfr_init2() is

     ctypedef __mpfr_struct* mpfr_t
     void mpfr_init2 (mpfr_t x, mp_prec_t prec)

Cython generates this code:

     mpfr_t __pyx_t_7;
     ...
     __pyx_t_7 = (((struct ...)__pyx_v_self)->_args[__pyx_v_i]);
     ...
     mpfr_init2(__pyx_t_7, __pyx_t_8);

Looks reasonable at first sight. However, gcc complains about the temp 
assignment:

   sage/ext/interpreters/wrapper_rr.c:2737: error: incompatible types in 
assignment

Any idea what might be going wrong here?

Stefan
_______________________________________________
Cython-dev mailing list
Cython-dev@codespeak.net
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to