/* PBXB64 C frontend: exercise bit-field value lowering
 * (c_frontend_lexer_value.c: c_emit_bitfield_load, c_emit_store_bitfield).
 */

struct Flags {
    unsigned int a : 4;
    unsigned int b : 4;
    unsigned int d : 8;
};

int main(void)
{
    struct Flags f;
    f.a = 5;
    f.b = 10;
    f.d = 255;

    if (f.a != 5) return 1;
    if (f.b != 10) return 2;
    if (f.d != 255) return 3;

    /* mutate and re-read */
    f.a = 15;
    if (f.a != 15) return 4;

    return 0;
}
