Using V8.00.60 (64-bit) of Pelles C with either 32-bit or 64-bit output (and also under 32-bit V7.00.355) with the Microsoft extensions enabled, the following short program:
#include <stdio.h>
struct {
void *foo;
unsigned long index : 28,
flags : 4;
} bar, *ptr = &bar;
int main(void)
{
ptr->flags = 3;
ptr->flags &= ~1; // Clear the page loading flag, page is now usable!
printf("%d\n", ptr->flags);
}
prints a 2 with optimization="None", and a 3 with optimization="Maximize Speed". The correct answer is 2. The problem seems to be that with optimizations enabled, the statement containing the "&=" operation produces no code. This is also true if the more verbose form of &= is used ("ptr->flags = ptr->flags & ~1;").
Richie