1 #include <stdio.h> 2 3 struct foo { 4 unsigned int x:1; 5 unsigned int y:1; 6 }; 7 8 int main()9main() { 10 struct foo bar; 11 struct foo *p; 12 13 p = &bar; 14 bar.x = 0; 15 bar.y = 0; 16 17 /* 18 * 05/25/09: TERRIBLE! We didn't handle bitfield assignment for 19 * indirect struct access correctly! 20 */ 21 printf("%d %d\n", bar.x, bar.y); 22 p->x = 1; 23 printf("%d %d\n", bar.x, bar.y); 24 p->y = 1; 25 printf("%d %d\n", bar.x, bar.y); 26 p->y = 0; 27 printf("%d %d\n", bar.x, bar.y); 28 return 0; 29 } 30 31