Ok, I have found out a little more about the issue. Alignment does
not appear to be the issue. The reason for the problem seems to be
the instruction that gets executed.
The following C program reproduces the problem:
#include <signal.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void handler(int sig)
{
fprintf(stderr,"my signal handler caught signal %d\n",sig);
exit(sig);
}
int main()
{
signal(SIGSEGV, handler);
sleep(5);
asm(".long 0x203003E7");
return 0;
}
The signal handler gets invoked if you kill it with "kill -11" in the
first 5 seconds. Otherwise, the "subfic r1,r16,999" instruction
(represented by the .long) is executed, which apparently destroys r1
(which seems to be the stack pointer), and that leads to a SIGSEGV
sooner or later (or, in the Gforth case, something else might cause a
SIGSEGV before that happens).
In any case, my guess is that, once the signal handler is invoked, it
tries to access the stack, resulting in another SIGSEGV, and then the
general signal handling code is smart enough to give up and exit with
a "Segmentation Fault" message instead of looping endlessly in the
signal handling code.
I don't see a good way to prevent such things in every case, so I
would recommend leaving Gforth as it is (i.e., direct threaded), and
closing the bug report.
- anton
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]