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

Wrong result from const-evaluated 32-bit `-` `~` #66

Closed fuhsnn closed 5 months ago

fuhsnn commented 5 months ago
#include <stdio.h>
long neg = -1U;
long not = ~1U;
int main(void) {
    printf("%ld\n", neg); // expected 4294967295, got -1
    printf("%ld\n", not); // expected 4294967294, got -2
}