[webkit-dev] Bit fields cause Purify to report UMRs
anyang.ren at gmail.com
Wed May 2 18:37:27 PDT 2007
On 5/2/07, David Hyatt <hyatt at apple.com> wrote:
> This seems like a pretty sad technical limitation of Purify.
Yes. I thought about this problem for a while, and the best
solution I came up with requires changes to compilers.
Using my example and pseudocode:
Suppose bit field x is the 0th bit (least significant bit) of a word w
and bit field y is the 1st bit. To initialize x to a and y to b, the
compiler would generate this pseudocode:
unsigned w; // uninitialized
w |= (a & 0x1); // x(a)
w |= (b & 0x1) << 1; // y(b)
In generating the code for a constructor, the compiler could either
initialize w to 0, or use = instead of |= in the very first bit field
> Have you considered running a script over the source code to
> eliminate the bit fields and then just pass that altered source code
> to Purify?
I'm afraid that I will have to do this. I did verify that eliminating
the bit fields manually eliminated the UMRs for the constructor
of that class. So this suggestion will work. Thank you for your
Regarding the "incorrect" structure size on Windows because MSVC
packs 'unsigned' and 'bool' bit fields separately, would you consider
declaring all bit fields as 'unsigned'?
Open source developer
More information about the webkit-dev