[lttng-dev] [PATCH babeltrace v3] Fix: bitfield: left shift undefined behavior

Simon Marchi simon.marchi at efficios.com
Thu May 9 10:19:23 EDT 2019

On 2019-05-09 10:02 a.m., Simon Marchi wrote:
> I might have more cases for you to investigate :)
> Can you try building with -fsanitize=undefined and run test_bitfield? I get some:
> /home/smarchi/src/babeltrace/tests/lib/test_bitfield.c:222:4: runtime error: left shift of negative value -1
> Which would hint that we are missing a cast before a shift.
> Simon

I digged a bit, and it's these lines

  ___v >>= final;

  ___v <<= final;

in _bt_piecewise_lshift and _bt_piecewise_rshift.


More information about the lttng-dev mailing list