Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

TCC Tiny C Compiler Bugs

Name: Anonymous 2017-04-11 18:46

I have found some bugs in TCC http://bellard.org/tcc/, but author doesn't maintain it anymore. What should I do?

Here is one bug example:

#include <stdio.h>

#define SHR(x) ((intptr_t)(x)/(1<<3))
typedef struct test_t {void *x;} test_t;
static test_t test = {(void *)-8};

int main(int argc, char **argv) {
printf("%d=%d\n", SHR(test.x), SHR((void *)-8));
return 0;
}

Name: Anonymous 2017-04-11 21:03

TCC has a mailing list, you should probably report it there.
The bug you posted seems to be related to static initialization by the way:

#include <stdio.h>

typedef struct test_t {
void *x;
} test_t;
static test_t test = { .x = (void *)0xffffffffffffffff };

int main(int argc, char **argv) {
printf("ptr = %p\n", (void *)0xffffffffffffffff);
printf("test.x = %p\n", test.x);
test.x = (void *)0xffffffffffffffff;
printf("test.x = %p\n", test.x);
return 0;
}

The statically initialized version of text.x gets truncated.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List