1995-08-09 08:06:35 -07:00
|
|
|
/***********************************************************************/
|
|
|
|
/* */
|
1996-04-30 07:53:58 -07:00
|
|
|
/* Objective Caml */
|
1995-08-09 08:06:35 -07:00
|
|
|
/* */
|
|
|
|
/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */
|
|
|
|
/* */
|
1996-04-30 07:53:58 -07:00
|
|
|
/* Copyright 1996 Institut National de Recherche en Informatique et */
|
1995-08-09 08:06:35 -07:00
|
|
|
/* Automatique. Distributed only by permission. */
|
|
|
|
/* */
|
|
|
|
/***********************************************************************/
|
|
|
|
|
|
|
|
/* $Id$ */
|
|
|
|
|
1995-05-09 02:36:12 -07:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <signal.h>
|
|
|
|
#include <setjmp.h>
|
|
|
|
|
|
|
|
double foo;
|
|
|
|
|
1997-09-02 05:55:01 -07:00
|
|
|
void access_double(double *p)
|
1995-05-09 02:36:12 -07:00
|
|
|
{
|
|
|
|
foo = *p;
|
|
|
|
}
|
|
|
|
|
|
|
|
jmp_buf failure;
|
|
|
|
|
1997-09-02 05:55:01 -07:00
|
|
|
void sig_handler(int sig)
|
1995-05-09 02:36:12 -07:00
|
|
|
{
|
|
|
|
longjmp(failure, 1);
|
|
|
|
}
|
|
|
|
|
1997-09-02 05:55:01 -07:00
|
|
|
int main(void)
|
1995-05-09 02:36:12 -07:00
|
|
|
{
|
|
|
|
long n[10];
|
|
|
|
int res;
|
|
|
|
signal(SIGSEGV, sig_handler);
|
1998-03-13 11:59:11 -08:00
|
|
|
#ifdef SIGBUS
|
1995-05-09 02:36:12 -07:00
|
|
|
signal(SIGBUS, sig_handler);
|
1998-03-13 11:59:11 -08:00
|
|
|
#endif
|
1995-05-09 02:36:12 -07:00
|
|
|
if(setjmp(failure) == 0) {
|
|
|
|
access_double((double *) n);
|
|
|
|
access_double((double *) (n+1));
|
|
|
|
res = 0;
|
|
|
|
} else {
|
|
|
|
res = 1;
|
|
|
|
}
|
|
|
|
signal(SIGSEGV, SIG_DFL);
|
1998-03-13 11:59:11 -08:00
|
|
|
#ifdef SIGBUS
|
1995-05-09 02:36:12 -07:00
|
|
|
signal(SIGBUS, SIG_DFL);
|
1998-03-13 11:59:11 -08:00
|
|
|
#endif
|
1995-05-09 02:36:12 -07:00
|
|
|
exit(res);
|
|
|
|
}
|
|
|
|
|