The following bug happens when compiling with kcc-1.1.2-40 (and not with gcc-2.96-78). test.c: --------------------------- cut here --------------------------------- #include <stdio.h> #include <signal.h> void arret (int n) { int err=0; printf ("err=%d\n", err); } int main (int argc, char **argv) { int err[4]; struct sigaction sig; sig.sa_handler = arret; err[0] = sigaction (SIGTERM, &sig, NULL); while (1); return 0; } --------------------------- cut here --------------------------------- $ kgcc -Wall -g -o test test.c $ ./test Then, send SIGTERM to the process 'test'. This one halts with: Segmentation fault Note: The kernel is a 2.2.4, and glibc is 2.2.2-5.
Cannot reproduce it with either glibc 2.2.2-4 and 2.2.2-6, (there were no suspicious changes in 2.2.2-5), on kernel 2.4.0.
If this can help, feel free to test the "bug" on my PC: $ ssh -l guest baud.dyndns.org The password is 'guest'. Files 'test.c' and 'test' are in the homedir.
The issue is that you don't have compat-glibc installed. kgcc does not require it, since kgcc is for kernel compilation only. If you want to use it for userland compilation, then you should install compat-egcs (and that requires compat-glibc) and use either egcs or i386-glibc21-linux-gcc gcc drivers. BTW: This has been revamped recently, so there is no kgcc package any longer and egcs/kgcc/egcs++ commands in compat-* packages mean egcs 1.1.2 using glibc 2.2.2 headers and linking against those libraries, while i386-glibc21-* commands use glibc 2.1.x headers and link against 2.1.x libraries.
In fact the testcase is very sensitive to lots of things. For example, a different order in the declaration of variables makes it works or not. This makes me think that something is wrong somewhere in gcc or glibc... I found a new testcase that segfaults (on a SIGTERM signal) with gcc-2.96-78 + glibc-2.2.2-5 + kernel-2.4.2. Would you mind testing it at RedHat or on my PC? test.c: --------------------------- cut here --------------------------------- #include <stdlib.h> #include <stdio.h> #include <signal.h> void arret (int n) { printf ("End.\n"); exit (0); } int main (int argc, char **argv) { struct sigaction sig; int err; sig.sa_handler = arret; err = sigaction (SIGTERM, &sig, NULL); while (1); return 0; } --------------------------- cut here ---------------------------------
Sorry, the bug was in the programmer (me)!