fuhsnn / slimcc

C11 compiler with GNU extensions for x86-64 Linux, working towards C23
MIT License
36 stars 4 forks source link

Boolean variables wrongly initialized with non-bool value #86

Closed fuhsnn closed 3 weeks ago

fuhsnn commented 3 weeks ago
#include <stdio.h>

_Bool b = 2;
_Bool a[] = {3,3,3};
struct {
    _Bool b;
} s = {4};

int main(void) {
    printf("%d\n", b); // expected 1, got 2
    printf("%d\n", a[2]); // expected 1, got 3
    printf("%d\n", s.b); // expected 1, got 4
}