[cfe-commits] c bitfield issue
Fariborz Jahanian
fjahanian at apple.com
Mon Dec 15 14:31:56 PST 2008
I ran into this bug, having to do with 'signed char' bitfield. Is this
a known issue/problem
with clang?
- Thanks, Fariborz
struct Foo {
signed char _field1 : 5;
signed char _field2 : 3;
};
struct Foo foo;
int main()
{
struct Foo *f = &foo;
f->_field1 = 0xf;
printf("f->_field1 = %x\n", f->_field1);
f->_field2 = 0x3;
printf("f->_field2 = %x\n", f->_field2);
return 0;
}
clang produces the result:
% ./a.out
f->_field1 = f
f->_field2 = ffffffff <---- Does not look right! should be f
More information about the cfe-commits
mailing list