Jim Apple has uploaded this change for review. ( 
http://gerrit.cloudera.org:8080/11406


Change subject: IMPALA-5031: undefined behavior: codegen signed overflow
......................................................................

IMPALA-5031: undefined behavior: codegen signed overflow

This patch changes the way signed integer arithmetic is performed in
generated code. It uses unsigned arithmetic instead, because overflow
causes undefined behavior according to the standard.

Compiling with -full_ubsan, the following types of errors are avoided
by this patch:

    exprs/operators-ir.cc:167:803: runtime error: signed integer
    overflow: -9223372036854775807 + -9223372036854775807 cannot be
    represented in type 'long'

    exprs/operators-ir.cc:168:823: runtime error: signed integer
    overflow: -9223372036854775807 - 9223372036854775807 cannot be
    represented in type 'long'

    exprs/operators-ir.cc:169:823: runtime error: signed integer
    overflow: -9223372036854775807 * -9223372036854775807 cannot be
    represented in type 'long'

This is visible when running be/build/latest/exprs/expr-test
--gtest_filter=ExprTest.ArithmeticExprs

To check for performance regressions, I ran TPCH and TPCDS at scale
factor 20 with three minicluster nodes and observed no performance
changes.

Change-Id: I79ec3a5ed974709e5e47be6b074d39ee89461f7f
---
M be/src/exprs/operators-ir.cc
1 file changed, 51 insertions(+), 8 deletions(-)



  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/06/11406/1
--
To view, visit http://gerrit.cloudera.org:8080/11406
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I79ec3a5ed974709e5e47be6b074d39ee89461f7f
Gerrit-Change-Number: 11406
Gerrit-PatchSet: 1
Gerrit-Owner: Jim Apple <[email protected]>

Reply via email to