Impala Public Jenkins has submitted this change and it was merged. ( 
http://gerrit.cloudera.org:8080/11604 )

Change subject: IMPALA-5031: fix signed overflows in decimal
......................................................................

IMPALA-5031: fix signed overflows in decimal

The standard says that overflow for signed arithmetic operations is
undefined behavior; see [expr]:

    If during the evaluation of an expression, the result is not
    mathematically defined or not in the range of representable values
    for its type, the behavior is undefined.

and [basic.fundamental]:

    Unsigned integers shall obey the laws of arithmetic modulo 2^n
    where n is the number of bits in the value representation of that
    particular size of integer. This implies that unsigned arithmetic
    does not overflow because a result that cannot be represented by
    the resulting unsigned integer type is reduced modulo the number
    that is one greater than the largest value that can be represented
    by the resulting unsigned integer type.

All of the overflows fixed in this patch were tested with expr-test's
DecimalArithmeticTest.

Change-Id: Ibf882428931e4f4264be2fc8cd9d6b1fc89b8ace
Reviewed-on: http://gerrit.cloudera.org:8080/11604
Reviewed-by: Jim Apple <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>
---
M be/src/exprs/operators-ir.cc
M be/src/runtime/decimal-value.inline.h
M be/src/runtime/multi-precision.h
A be/src/util/arithmetic-util.h
M be/src/util/bit-util.h
M be/src/util/decimal-util.h
6 files changed, 145 insertions(+), 87 deletions(-)

Approvals:
  Jim Apple: Looks good to me, approved
  Impala Public Jenkins: Verified

--
To view, visit http://gerrit.cloudera.org:8080/11604
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ibf882428931e4f4264be2fc8cd9d6b1fc89b8ace
Gerrit-Change-Number: 11604
Gerrit-PatchSet: 3
Gerrit-Owner: Jim Apple <[email protected]>
Gerrit-Reviewer: Bikramjeet Vig <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Jim Apple <[email protected]>
Gerrit-Reviewer: Joe McDonnell <[email protected]>

Reply via email to