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

2019-05-07 Thread Mathieu Desnoyers
bitfield.h uses the left shift operator with a left operand which may be negative. The C99 standard states that shifting a negative value is undefined. We also need to cast the result explicitly into the left hand side type to deal with: warning: large integer implicitly truncated to unsigned typ

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

2019-05-07 Thread Simon Marchi
On 2019-05-07 4:40 p.m., Mathieu Desnoyers wrote: > bitfield.h uses the left shift operator with a left operand which > may be negative. The C99 standard states that shifting a negative > value is undefined. Please add a reference to the original problem that prompted you to do this change in the

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

2019-05-08 Thread Mathieu Desnoyers
- On May 7, 2019, at 6:13 PM, Simon Marchi sim...@simark.ca wrote: > On 2019-05-07 4:40 p.m., Mathieu Desnoyers wrote: >> bitfield.h uses the left shift operator with a left operand which >> may be negative. The C99 standard states that shifting a negative >> value is undefined. Hi Simon, Th