Commit fe68a83e authored by Stefan Behnel's avatar Stefan Behnel

disable some constant folding operations that can break code

parent 2337909d
...@@ -877,7 +877,9 @@ class FloatNode(ConstNode): ...@@ -877,7 +877,9 @@ class FloatNode(ConstNode):
type = PyrexTypes.c_double_type type = PyrexTypes.c_double_type
def calculate_constant_result(self): def calculate_constant_result(self):
self.constant_result = float(self.value) # calculating float values is usually not a good idea
#self.constant_result = float(self.value)
pass
def compile_time_value(self, denv): def compile_time_value(self, denv):
return float(self.value) return float(self.value)
...@@ -3889,7 +3891,9 @@ class TypecastNode(NewTempExprNode): ...@@ -3889,7 +3891,9 @@ class TypecastNode(NewTempExprNode):
self.operand.check_const() self.operand.check_const()
def calculate_constant_result(self): def calculate_constant_result(self):
self.constant_result = self.operand.constant_result # we usually do not know the result of a type cast at code
# generation time
pass
def calculate_result_code(self): def calculate_result_code(self):
opnd = self.operand opnd = self.operand
...@@ -4949,7 +4953,8 @@ class CoercionNode(NewTempExprNode): ...@@ -4949,7 +4953,8 @@ class CoercionNode(NewTempExprNode):
print("%s Coercing %s" % (self, self.arg)) print("%s Coercing %s" % (self, self.arg))
def calculate_constant_result(self): def calculate_constant_result(self):
self.constant_result = self.arg.constant_result # constant folding can break type coercion, so this is disabled
pass
def annotate(self, code): def annotate(self, code):
self.arg.annotate(code) self.arg.annotate(code)
......
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