Project

General

Profile

Bug #12241

smatch: misreported 'mask and shift to zero'

Added by Toomas Soome 2 months ago. Updated 2 months ago.

Status:
In Progress
Priority:
Normal
Assignee:
Category:
tools - gate/build tools
Start date:
Due date:
% Done:

90%

Estimated time:
Difficulty:
Medium
Tags:

Description

match_binop2() is testing expressions in form: (mask & value) >> shift

and fails with variable >> shift, because we get incoming expression set to: (mask & ) >> shift and the mask value may not be correct.

In specific error case we do have 64-bit lhs for >> operator, and we do shift 32 bits; the mask value is set to 32-bit unsigned max and shifting it by 32 bits, we do end up with match_binop2() reporting the warning.

example warning case:
/code/illumos-gate/usr/src/tools/proto/root_sparc-nd/opt/onbld/bin/sparc/smatch: /code/illumos-gate/usr/src/common/bignum/bignumimpl.c:1410 big_mul_add_vec() warn: mask and shift to zero

History

#1

Updated by Toomas Soome 2 months ago

  • Description updated (diff)

Also available in: Atom PDF