Re: [PATCH 2/2] extra: Fix handle_bit_test so that null set condition is taken care of
Dan Carpenter <[email protected]> Tue, 13 Jul 2021 18:35:28 +0300
| Newsgroups | org.kernel.vger.smatch |
|---|---|
| Message-ID | <20210713153527.GS1954@kadam> |
I have applied the first commit but this one still needs work. Consider
this test case:
#include "check_debug.h"
unsigned int frob();
void test(void)
{
unsigned int mask = 0xff0;
unsigned int x = frob();
if (frob())
mask |= 0x2;
if (x < 0 || x > 11)
return;
if ((1 << x) & mask) {
__smatch_implied(x);
return;
}
__smatch_implied(x);
}
The output is:
test.c:17 test() implied: x = '1-11'
test.c:20 test() implied: x = '0'
The first implied is correct but the second is wrong. BIT(1) or 0x2 is
*possibly* set or *possibly not* set. So on the false path the range
list should be 0-1.
regards,
dan carpenter