C++ has some constructs that have undefined behavior. Shall we test for
this during pre-merge testing?

When the behavior of C++ code is formally "undefined" by the standard,
compilers can behave erratically, like not taking either branch of a
if/else statement. This can be reproduced in the wild. The standard itself
notes:

"Using a bool value in ways described by this International Standard as
'undefined,' such as by examining the value of an uninitialized automatic
object, might cause it to behave as if it is neither true nor false."

Clang has a checker for this called UBSAN, and, after some effort, the data
loading part of our build is now UBSAN-clean. I'm suggesting we add that
test to the pre-merge testing. I'm happy to handle the details.

When it fails, the output will look something like this:

https://jenkins.impala.io/job/ubuntu-16.04-from-scratch/3573/console

exprs/math-functions-ir.cc:405:13: runtime error: signed integer overflow:
4738381338321616896 * 36 cannot be represented in type 'long'
runtime/decimal-value.inline.h:254:17: runtime error: signed integer
overflow: 0x4b3b4ca85a86c47a098a223fffffffff +
0x4b3b4ca85a86c47a098a223fffffffff cannot be represented in type '__int128'
runtime/row-batch-serialize-test.cc:243:18: runtime error: variable length
array bound evaluates to non-positive value 0

Reply via email to