lkml.org 
[lkml]   [1996]   [Apr]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: signal(SIGFPE,SIG_IGN) causes endless loop
Date
Albert Cahalan <albert@ccs.neu.edu> writes:
> >>> #include <stdio.h>
> >>> #include <signal.h>
> >>>
> >>> int main()
> >>> {
> >>> int a,b,c;
> >>>
> >>> signal(SIGFPE,SIG_IGN);
> >>> a = 1;
> >>> b = 0;
> >>> c = a/b;
> >>> return 0;
> >>> }
>
> OK, what about x86 OSs? This could affect iBCS a bit.
>
> SCO Unix:

Well on SCO the proram above does not compile! The compiler notices the
divide by zero :-)

The following program compiles:

#include <stdio.h>
#include <signal.h>

int ret_zero()
{
return 0;
}

int main()
{
int a,b,c;

signal(SIGFPE,SIG_IGN);
a = 1;
b = ret_zero();
c = a/b;
return 0;
}

when executed, it loops just like Linux!

This is Open Desktop 1.1 (SCO Unix 3.2v2.0).
Same on OpenDesktop 2.0 (SCO Unix 3.2v4.0).

Cheers,
Stephen
--
Stephen Rothwell Stephen.Rothwell@nec.com.au
NEC Australia Phone: +61-6-2508747
Information Systems Group Fax: +61-6-2508746
Canberra, Australia


\
 
 \ /
  Last update: 2005-03-22 13:37    [W:0.051 / U:0.820 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site