Commit 9a61d296 authored by Stefan Behnel's avatar Stefan Behnel

resolved strict aliasing problem by changing type cast

parent 1edfca7f
...@@ -821,10 +821,13 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -821,10 +821,13 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
#if need_self_cast: #if need_self_cast:
# self.generate_self_cast(scope, code) # self.generate_self_cast(scope, code)
if type.vtabslot_cname: if type.vtabslot_cname:
code.putln("*(struct %s **)&p->%s = %s;" % ( if base_type:
type.vtabstruct_cname, struct_type_cast = "(struct %s*)" % base_type.vtabstruct_cname
else:
struct_type_cast = ""
code.putln("p->%s = %s%s;" % (
type.vtabslot_cname, type.vtabslot_cname,
type.vtabptr_cname)) struct_type_cast, type.vtabptr_cname))
for entry in py_attrs: for entry in py_attrs:
if entry.name == "__weakref__": if entry.name == "__weakref__":
code.putln("p->%s = 0;" % entry.cname) code.putln("p->%s = 0;" % entry.cname)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment