Tim Armstrong has posted comments on this change. Change subject: Add a build flag for the undefined behavior sanitizer, aka "ubsan". ......................................................................
Patch Set 1: (5 comments) http://gerrit.cloudera.org:8080/#/c/5082/1/be/src/exprs/aggregate-functions-ir.cc File be/src/exprs/aggregate-functions-ir.cc: Line 157: if (LIKELY(dst->ptr && src.ptr)) memcpy(dst->ptr, src.ptr, src.len); Prefer explicit NULL checks. I also don't believe this change is necessary and could mask other bugs. If src.ptr is NULL, that means src.len is 0 (unless there's a bug), which means that dst->ptr should have been set to NULL by the StringVal constructor. http://gerrit.cloudera.org:8080/#/c/5082/1/be/src/runtime/coordinator.cc File be/src/runtime/coordinator.cc: PS1, Line 1684: accumulators::count(completion_times) > accumulators::count(completion_times) can be zero, making mean and variance Can you do an explicit comparison against 0 here? Line 1701: if (accumulators::count(rates)) { And here http://gerrit.cloudera.org:8080/#/c/5082/1/be/src/runtime/row-batch-serialize-test.cc File be/src/runtime/row-batch-serialize-test.cc: PS1, Line 164: len > int buf[x] where x is a 0-length variable at run-time is UB How about using a vector or string here instead to avoid the extra branch. http://gerrit.cloudera.org:8080/#/c/5082/1/bin/run-backend-tests.sh File bin/run-backend-tests.sh: Line 41: export PATH="${IMPALA_TOOLCHAIN}/llvm-${IMPALA_LLVM_VERSION}/bin:${PATH}" > http://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#stack-traces-and It's a bit unfortunately there isn't a cleaner way to do this. -- To view, visit http://gerrit.cloudera.org:8080/5082 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: comment Gerrit-Change-Id: I88c7234bd7c5eb7404490a0913d90470c10835e7 Gerrit-PatchSet: 1 Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-Owner: Jim Apple <jbap...@cloudera.com> Gerrit-Reviewer: Dan Hecht <dhe...@cloudera.com> Gerrit-Reviewer: Jim Apple <jbap...@cloudera.com> Gerrit-Reviewer: Tim Armstrong <tarmstr...@cloudera.com> Gerrit-HasComments: Yes