Hello Tim Armstrong, Dan Hecht, Impala Public Jenkins,
I'd like you to reexamine a change. Please visit
http://gerrit.cloudera.org:8080/11406
to look at the new patch set (#3).
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. I also checked the LLVM IR to see that the generated code
after this commit is identical to the generated code at the previous
commit, except that the new code doesn't use the 'nsw' modifier. That
modifier normally indicates that signed wrap does not occur; in this
case the operation happens on unsigned representation of the same
bits, that modifier is no longer relevant.
Change-Id: I79ec3a5ed974709e5e47be6b074d39ee89461f7f
---
M be/src/exprs/operators-ir.cc
M be/src/util/bit-util.h
2 files changed, 95 insertions(+), 8 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/06/11406/3
--
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: newpatchset
Gerrit-Change-Id: I79ec3a5ed974709e5e47be6b074d39ee89461f7f
Gerrit-Change-Number: 11406
Gerrit-PatchSet: 3
Gerrit-Owner: Jim Apple <[email protected]>
Gerrit-Reviewer: Dan Hecht <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Jim Apple <[email protected]>
Gerrit-Reviewer: Tim Armstrong <[email protected]>