Eric Botcazou <ebotca...@adacore.com> writes: >> gcc/ada/init.c (__gnat_install_handler) explicitly does not include >> SA_SIGINFO in sa_flags, which means the handler only gets one arg, sig. >> Still the installed handler (__gnat_error_handler) accesses args beyond >> the first. > > Why would it get only one arg? The comment explicitly says that it gets > three. > Or is the prototype bogus in this case?
It gets three *if SA_SIGINFO is set in act.sa_flags*, which is is not. >> There are two possible solutions: >> >> * Actually set SA_SIGINFO. >> >> * Punt and cast the second __gnat_error_handler `arg' to an int. >> Running under gdb, it seems that three args are really passed. > > Why does it not work to just change act.sa_handler to act.sa_sigaction? That's what I did in my last patch, but without SA_SIGINFO set. This doesn't work since the additional args passed in the sa_handler case are not in any prototype, to g++ rightly complains (and this is an implementation detail I'd not rely upon if it can be avoided). >> I prefer the first, since that's the clean solution. Unfortunately, my >> question why the current code doesn't set SA_SIGINFO, yet cites a >> considerable part of the man page about its effects, remained unanswered >> when I submitted the patch. > > I'd go for the minimal change that works, including an ugly cast somewhere. I'm just testing the SA_SIGINFO path, which seems the correct way if it works. Rainer -- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University