From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <1d5d51400807040717xbf9fbf7v7466ae0394b77255@mail.gmail.com> Date: Fri, 4 Jul 2008 22:17:38 +0800 From: "Fernan Bolando" To: "Charles Forsyth" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <1d5d51400807040117i242cae83y6d65e8972748ea47@mail.gmail.com> Cc: 9fans@9fans.net Subject: Re: [9fans] signal.h in APE for newbies Topicbox-Message-UUID: db072422-ead3-11e9-9d60-3106f5b1d025 On 7/4/08, Charles Forsyth wrote: > > When I trigger a division by zero the handler is not called, I just > > get trap 19 message. > > > if i do a floating-point division by zero, the SIGFPE signal handler is called, > because ape's signal recognises the initial "sys: fp: ". (ie, it works for me.) > > it doesn't work for an integer division by zero, which produces a different message for the underlying notify: > > 8.out 205840: suicide: sys: trap: divide error pc=0x00001089 > > but that's fine too! Linux's signal(2) says, apparently referring to POSIX rules: > > .... Integer division by zero has undefined result. > On some architectures it will generate a SIGFPE signal. (Also dividing > the most negative integer by -1 may generate SIGFPE.) Ignoring this > signal might lead to an endless loop. > > Linux might not be particularly good at documenting this particular area, > so perhaps the standard(s) have useful hints or advice that APE could follow. > > Any chance this is some 9vx issue? I tried the test code below it worked in 9grid.jp ,but gave the following message in 9vx 8.out 89: suicide: sys: trap: 19 (reserved) pc=0x00001067 #include #include void e_hand(int sig) { printf("Signal"); return; } int main() { double a, d; d = 5.0; signal(SIGFPE, e_hand); a = 1/(d-5); return 0; } -- http://www.fernski.com