Project

General

Profile

Actions

Bug #12241

open

smatch: misreported 'mask and shift to zero'

Added by Toomas Soome over 1 year ago. Updated over 1 year ago.

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

90%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

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

Actions #1

Updated by Toomas Soome over 1 year ago

  • Description updated (diff)
Actions #2

Updated by John Levon over 1 year ago

still apparently there post-#12716

Actions #3

Updated by Electric Monk over 1 year ago

  • Gerrit CR set to 337
Actions

Also available in: Atom PDF