[Pyrex] gcc's -fstrict-aliasing optimization can break vtable construction in PyMODINIT_FUNC

Greg Ewing greg.ewing at canterbury.ac.nz
Sat Nov 24 23:49:50 CET 2007


Dan Gindikin wrote:
> I too have seen this problem go away with other optimization flag sets, 
> but I thought and still think it most likely, that it's about the 
> aliasing.

It's quite possible that gcc is getting confused because of
the casts being used to store the function pointers, and that
-fno-strict-aliasing is indeed the right way to fix it (short
of reworking the code generation to use less confusing casts,
which probably ought to be done eventually).

But doesn't Python extension code need to be compiled with
-fno-strict-aliasing anyway for other reasons? Or am I thinking
of some other flag?

If -fno-strict-aliasing is needed anyway, I'm inclined to
leave it the way it is for now.

--
Greg



More information about the Pyrex mailing list