From: Stefan Behnel Date: Thu, 12 Jun 2008 14:41:41 +0000 (+0200) Subject: resolved strict aliasing problem by changing type cast X-Git-Tag: 0.9.8.1~137^2~1 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=9a61d2962aed5eccd288d1b78f0f2402b2b2096d;p=cython.git resolved strict aliasing problem by changing type cast --- diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py index 40e31ca9..1bc6f3fe 100644 --- a/Cython/Compiler/ModuleNode.py +++ b/Cython/Compiler/ModuleNode.py @@ -821,10 +821,13 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): #if need_self_cast: # self.generate_self_cast(scope, code) if type.vtabslot_cname: - code.putln("*(struct %s **)&p->%s = %s;" % ( - type.vtabstruct_cname, + if base_type: + struct_type_cast = "(struct %s*)" % base_type.vtabstruct_cname + else: + struct_type_cast = "" + code.putln("p->%s = %s%s;" % ( type.vtabslot_cname, - type.vtabptr_cname)) + struct_type_cast, type.vtabptr_cname)) for entry in py_attrs: if entry.name == "__weakref__": code.putln("p->%s = 0;" % entry.cname)