tinycc-devel@nongnu.org wrote in <47c96f8b-130b-c0b7-79f2-a33e13256...@ludocode.com>: |I've encountered what I believe is a miscompilation bug in TinyCC. \ |I'm using |tcc 0.9.27 on latest Arch Linux on x86_64. I can't reproduce the same \ |issue on |the mob branch so this may already be fixed, but I can't find a bug report |about anything similar so it may just be a coincidence; the bug might \ |still be |around, just reproducible in a different way. I tried reducing the \ |code as much |as possible: | | #include <stdint.h> | #include <stdio.h> | | typedef struct coords_t { | uint8_t x, y; | } coords_t; | | typedef struct list_t { | void* context; | coords_t head; | coords_t tail; | } list_t; | | static coords_t list_head(list_t* list) { | return list->head; | } | | int main(void) { | list_t list; | list.tail.x = 17; | list.tail.y = 23; | | coords_t bob = {3, 4}; | coords_t alice = {2, 1}; | coords_t eve = {1, 0}; | | printf("%u:%u\n", eve.x, eve.y); | list_head(&list); // ignored return value, should be no-op | printf("%u:%u\n", eve.x, eve.y); | } | |The code prints the contents of a struct before and after a no-op function |call. The output should be the same. Under GCC, Clang and chibicc it prints |this: | | 1:0 | 1:0 | |Under TinyCC it prints this: | | 1:0 | 17:23
I cannot reproduce this with e5c3d1dc705f4c1b4ecccf795f97fa409914ea2e from January 4th. Damned U+00A0 whitespace ;P --steffen | |Der Kragenbaer, The moon bear, |der holt sich munter he cheerfully and one by one |einen nach dem anderen runter wa.ks himself off |(By Robert Gernhardt) _______________________________________________ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel