Hello all. The CI setup for tcpdump & libpcap includes various combinations of CPU architectures, OSes, C libraries and C compilers, this includes TCC on Linux with GNU libc (amd64 and armv7l). Today a pull request CI passed on amd64 and failed on armv7l because one of the resulting executable files segfaulted almost immediately after starting.
The changes in the pull request among other things added a call to atexit() to the program, and after some debugging and minimising the case it looks to me like a bug in TCC. I have found the bug report 56495 and the related mailing list thread from 2019, but it is not immediately clear whether this is the same problem or not, please review and confirm. Let me know if you need any additional information. The following C program reproduces the problem: $ cat test_atexit.c #include <stdlib.h> #include <stdio.h> static void exitfunc (void) { printf ("%s(): in\n", __func__); printf ("%s(): out\n", __func__); } int main (void) { printf ("%s(): in\n", __func__); atexit (exitfunc); printf ("%s(): out\n", __func__); return 0; } On the amd64 host (Debian 12) it works as expected: $ gcc test_atexit.c -o test_atexit && ./test_atexit main(): in main(): out exitfunc(): in exitfunc(): out $ tcc --version tcc version 0.9.27 (x86_64 Linux) $ tcc test_atexit.c -o test_atexit && ./test_atexit main(): in main(): out exitfunc(): in exitfunc(): out On the armv7l host (Ubuntu 22.04) the problem reproduces using TCC only: $ gcc test_atexit.c -o test_atexit && ./test_atexit main(): in main(): out exitfunc(): in exitfunc(): out $ tcc --version tcc version 0.9.27 (ARM Hard Float Linux) $ tcc test_atexit.c -o test_atexit && ./test_atexit main(): in Segmentation fault (core dumped) It reproduces the same using a more recent snapshot of TCC: $ tcc --version tcc version 0.9.28rc 2025-03-28 mob@f10ab130 (ARM eabihf Linux) $ tcc test_atexit.c -o test_atexit && ./test_atexit main(): in Segmentation fault (core dumped) -- Denis Ovsienko _______________________________________________ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel