STR-583: i686-apple-darwin: stratego tools that fork are signaled
pack-sdf:
opt/bin/pack-sdf -i TIL.sdf -o TIL.def –dep TIL.dep
including ./TIL.sdf
[ pack-sdf | warning ] process signaled: USR1 (10): User-defined signal 1parse-stratego has same problem:
minipowerrrr:~/tmp/strategoxt-0.17M1pre15325 martin$ /opt/bin/parse-stratego -i foo.str
[ parse-stratego | warning ] process signaled: USR1 (10): User-defined signal 1Strange enough, parse-stratego fails, but sglri succeeds. Investigating this issue.
Submitted on 3 June 2006 at 19:42
Issue Log
STR-583, martin:
The problem has been reproduced in a smaller setting. The signal is caused by the invocation of a nested function after a fork. The child process invokes a nested function defined by the parent process and fails.It’s not yet clear if this is a problem with recent GCC’s on all platforms. At least it is not Apple GCC 4.0.1 specific: FSF GCC 4.0.3 produces the same problem on i686-apple-darwin.
The test program:
————————————————–
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>void f(int x);
void g(int arg(int));
void h(int arg(int));int main(int argc, char* argv[])
{
f(2);
return 0;
}void f(int x)
{
auto int nested(int y);
int nested(int y)
{
return x + y;
}g(nested);
}void g(int arg(int))
{
pid_t pid = fork();if(pid == 0)
{
int x = arg(3);
fprintf(stderr, "x = %d
", x);
exit(0);
}
else
{
int status;
waitpid(pid, &status, 0);
fprintf(stderr, "exit? %d
", WIFEXITED(status) ? WEXITSTATUS(status) : -1);
fprintf(stderr, "signal? %d
", WIFSIGNALED(status) ? WTERMSIG(status) : -1);
}
}
——————————-This should print:
exit? 0
signal? -1But on the Mac/Intel it prints:
exit? -1
signal? 10
STR-583, martin:
4.0.2 on linux works fine.
STR-583, martin:
Simplifcation of the test program is attached.It turns out that the nested function needs to use a variable from the outer function, otherwise the process is not signaled.
STR-583, martin:
STR-583: Reverted the temorary work-arounds, which are no longer necessary now we have a new compilation scheme without nested functions.
Log in to post comments