Recently, I fixed an issue which is related to uninitialised bit-field in C
programming language. Because the bit-filed can be either 0
or 1
, so the bug will occur randomly. But the good news is the reproduced rate is very high, nearly 50%
. Though I am not familiar with the code, I used bisection assert
to help:
{
......
assert(bit-field == 0);
......
assert(bit-field == 0);
......
}
If the first assert
is not triggered, but the second one is, I can know which code block has the bug, then bisect code and add assert
again, until the root cause is found.