bitfields are supposed to be typically 'unsigned xxxxx'.
[edit]
The reason for that is just what you encountered; somebody using a bitfield in an 'unusual' way, getting results that they should not get.
The point of a bitfield is to reflect a bit. What values are in a bit? 0 and 1 (I'm only speaking of normal bits, I can't grok the quantum stuff). Yet, you have found a way to insert -1, 0, 1 into that very same field. Somewhere it's got to break. I believe that a lot of bitfield confusion results in negative bitfields and so the unsigned modifier eases that confusion.
When you define your bitfield as an int, you can have negative values. That is the reason for your results above.
Also, please see here for a more detailed engagement of this topic. Note that this has been rehash innumerable times on SO and so a search for 'bitfield unsigned' would prove quite instructive
[/edit]
To 'R.', re: "signedness ... is implementation-defined, but it can't vary from one element to another."
#include <stdio.h>
int main ()
{
struct bit{
char f1:1;
unsigned char f2:1;
};
struct bit b;
b.f1 = 1;
b.f2 = 1;
printf("%d\n",b.f1);
printf("%d\n",b.f2);
return 0;
}
produces, as output:
-1
1