Commit ea6a71ac 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

parent f7cd93f2
......@@ -4466,8 +4466,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)
......@@ -4506,11 +4509,11 @@ class CascadedAssignmentNode(AssignmentNode):
from ExprNodes import CloneNode, ProxyNode
self.rhs.analyse_types(env)
if not self.rhs.is_simple():
if use_temp:
self.rhs = self.rhs.coerce_to_temp(env)
else:
self.rhs = self.rhs.coerce_to_simple(env)
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)
self.rhs = ProxyNode(self.rhs)
self.coerced_rhs_list = []
......
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