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

make the RHS of assignments safe if the LHS target is a subset of a RHS attribute access

--HG--
extra : transplant_source : %D5%C52%5C7%CD%85%8F%3D7%9C%27%C6%8AGb%DBX%AEe
parent ee1686c0
......@@ -4430,8 +4430,11 @@ class SingleAssignmentNode(AssignmentNode):
dtype = self.lhs.type
self.rhs = self.rhs.coerce_to(dtype, env)
if use_temp:
if use_temp or self.rhs.is_attribute:
# cdef attribute access traverses pointers
self.rhs = self.rhs.coerce_to_temp(env)
else:
self.rhs = self.rhs.coerce_to_simple(env)
def generate_rhs_evaluation_code(self, code):
self.rhs.generate_evaluation_code(code)
......@@ -4470,8 +4473,8 @@ class CascadedAssignmentNode(AssignmentNode):
from ExprNodes import CloneNode, ProxyNode
self.rhs.analyse_types(env)
if not self.rhs.is_simple():
if use_temp:
if use_temp or self.rhs.is_attribute:
# (cdef) attribute access traverses pointers
self.rhs = self.rhs.coerce_to_temp(env)
else:
self.rhs = self.rhs.coerce_to_simple(env)
......
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