Ticket #226 (closed defect: fixed)
Type vtable needs types assignments for strict aliasing
| Reported by: | scoder | Owned by: | scoder |
|---|---|---|---|
| Priority: | major | Milestone: | 0.11 |
| Component: | Code Generation | Keywords: | |
| Cc: |
Description
When setting up the vtable of a type, the methods are first copied from the vtable of the superclass and then each overridden method is cast to (void(**)(void)) on assignment in the vtable as follows.
__pyx_vtable_4lxml_5etree__XSLTContext.__pyx_base = *__pyx_vtabptr_4lxml_5etree__BaseContext; *(void(**)(void))&__pyx_vtable_4lxml_5etree__XSLTContext.__pyx_base._copy = (void(*)(void))__pyx_f_4lxml_5etree_12_XSLTContext__copy;
Strict aliasing rules will allow the C compiler to execute the assignments in any order, which may let the first assignment overwrite the second, thus corrupting the vtable.
This can be prevented by getting rid of the cast on the LHS, which requires figuring out the correct signature of the function to cast the RHS (which is required because of the different self parameter).
Change History
Note: See
TracTickets for help on using
tickets.
