[Pyrex] gcc's -fstrict-aliasing optimization can break vtable construction in PyMODINIT_FUNC
Dan Gindikin
dg at pnylab.com
Sun Nov 25 01:59:54 CET 2007
Greg Ewing wrote:
> doesn't Python extension code need to be compiled with
> -fno-strict-aliasing anyway for other reasons?
Not sure, I found this PEP
http://www.python.org/dev/peps/pep-3123/
didn't find anything in the docs on the matter.
I heard of people doing this hack to get around this problem, have a
noop function like so:
void noop(void*) {}
Then if you call noop(vtableptr), that forces the compiler to not
re-order writes from before and after this call, since it has no way of
knowing whether "noop()" has any side-effects. Well, unless it inlines
"noop()".
Dan
More information about the Pyrex
mailing list