fuhsnn / slimcc

C11 compiler with GNU / C23 extensions for x86-64 Linux, able to build Python and PostgreSQL
MIT License
24 stars 3 forks source link

Missed int promotion with indirect bit-field expressions #54

Closed fuhsnn closed 5 months ago

fuhsnn commented 5 months ago
#include <stdio.h>

int main(void) {
    struct { unsigned b : 3; } s = {0};
    printf("%d\n", (~(0,s.b) < 0) ); // expected 1
    printf("%d\n", (~({s.b;}) < 0) ); // expected 1
    printf("%d\n", (~(1 ? s.b : s.b) < 0) ); // expected 1
}
fuhsnn commented 5 months ago

Fixed with 6e0322e