On 6/12/08, Stefan Behnel <[EMAIL PROTECTED]> wrote: > Cython currently generates this in the tp_new function of the Norwegian > class: > > *(struct __pyx_vtabstruct_7r_jiba1_Norwegian **)&p->__pyx_base.__pyx_vtab = > __pyx_vtabptr_7r_jiba1_Norwegian; > > which results in this strict aliasing warning with gcc 4.1: > > r_jiba1.c: In function '__pyx_tp_new_7r_jiba1_Norwegian': > r_jiba1.c:596: warning: dereferencing type-punned pointer will break > strict-aliasing rules
I do not see way this is wrong, but anyway, the generated code is confusing, you have a lhs cast and a dereferencing in the same line. > It goes away when I change it to this (patch is attached): > > p->__pyx_base.__pyx_vtab = > (struct __pyx_vtabstruct_7r_jiba1_Parrot*)__pyx_vtabptr_7r_jiba1_Norwegian; > And this is right, and much clear. In fact, it is equivalent to the following: PyTypeObject * tp = &PyList_Type; PyObject *p = (PyObject *) tp. So I do not expect that to NEVER break. If after the patch all tests pass, I would say you have to push it. -- Lisandro Dalcín --------------- Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC) Instituto de Desarrollo Tecnológico para la Industria Química (INTEC) Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET) PTLC - Güemes 3450, (3000) Santa Fe, Argentina Tel/Fax: +54-(0)342-451.1594 _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
