Commit 3ee23f4f authored by Robert Bradshaw's avatar Robert Bradshaw

Directive for overflow folding.

parent 7e1b07cc
......@@ -8048,6 +8048,7 @@ class NumBinopNode(BinopNode):
and not self.operand2.has_constant_result()):
self.operand1, self.operand2 = self.operand2, self.operand1
self.overflow_check = True
self.overflow_fold = env.directives['overflowcheck.fold']
self.func = self.type.overflow_check_binop(
self.overflow_op_names[self.operator],
env,
......
......@@ -3265,7 +3265,7 @@ class ConsolidateOverflowCheck(Visitor.CythonTransform):
return node
def visit_NumBinopNode(self, node):
if node.overflow_check:
if node.overflow_check and node.overflow_fold:
top_level_overflow = self.overflow_bit_node is None
if top_level_overflow:
self.overflow_bit_node = node
......
......@@ -82,6 +82,7 @@ directive_defaults = {
'cdivision': False, # was True before 0.12
'cdivision_warnings': False,
'overflowcheck': False,
'overflowcheck.fold': True,
'always_allow_keywords': False,
'allow_none_for_extension_args': True,
'wraparound' : True,
......
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