Commit 683aa853 authored by Stefan Behnel's avatar Stefan Behnel

fix C compiler warning when checking int overflow for division by enum values...

fix C compiler warning when checking int overflow for division by enum values on 32 bit systems (in case anyone cares...)
parent 6206e1a0
......@@ -9239,9 +9239,13 @@ class DivNode(NumBinopNode):
code.putln("}")
if self.type.is_int and self.type.signed and self.operator != '%':
code.globalstate.use_utility_code(division_overflow_test_code)
code.putln("else if (sizeof(%s) == sizeof(long) && unlikely(%s == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(%s))) {" % (
type_of_op2 = self.operand2.type.declaration_code('')
code.putln("else if (sizeof(%s) == sizeof(long)"
" && (!(((%s)-1) > 0)) && unlikely(%s == (%s)-1)"
" && unlikely(UNARY_NEG_WOULD_OVERFLOW(%s))) {" % (
self.type.declaration_code(''),
self.operand2.result(),
type_of_op2,
self.operand2.result(), type_of_op2,
self.operand1.result()))
code.put_ensure_gil()
code.putln('PyErr_Format(PyExc_OverflowError, "value too large to perform division");')
......
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