[igt-dev] [PATCH i-g-t] lib/intel_reg: fix shift undefined behaviour
Petri Latvala
petri.latvala at intel.com
Tue Apr 16 10:36:29 UTC 2019
On Thu, Mar 21, 2019 at 12:26:56PM +0200, Simon Ser wrote:
> 1<<31 (same as 2<<30) is undefined behaviour in C. When compiling with
> GCC and UBSan, it gives this error:
>
> ../tools/intel_reg_decode.c: In function ‘ivb_debug_port’:
> ../tools/intel_reg_decode.c:398:3: error: case label does not reduce to an integer constant
> case PORT_DBG_DRRS_HW_STATE_HIGH:
> ^~~~
>
> This happens because 1<<31 isn't representable as a signed int. Instead,
> use am unsigned int.
>
> Signed-off-by: Simon Ser <simon.ser at intel.com>
With s,am,an, in commit message,
Reviewed-by: Petri Latvala <petri.latvala at intel.com>
More information about the igt-dev
mailing list