]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/ocaml/contrib/config/auto-aux/int64align.c
Inital import
[l4.git] / l4 / pkg / ocaml / contrib / config / auto-aux / int64align.c
1 /***********************************************************************/
2 /*                                                                     */
3 /*                           Objective Caml                            */
4 /*                                                                     */
5 /*            Xavier Leroy, projet Cristal, INRIA Rocquencourt         */
6 /*                                                                     */
7 /*  Copyright 2000 Institut National de Recherche en Informatique et   */
8 /*  en Automatique.  All rights reserved.  This file is distributed    */
9 /*  under the terms of the GNU Library General Public License, with    */
10 /*  the special exception on linking described in file ../../LICENSE.  */
11 /*                                                                     */
12 /***********************************************************************/
13
14 /* $Id: int64align.c 4144 2001-12-07 13:41:02Z xleroy $ */
15
16 #include <stdio.h>
17 #include <signal.h>
18 #include <setjmp.h>
19 #include "m.h"
20
21 ARCH_INT64_TYPE foo;
22
23 void access_int64(ARCH_INT64_TYPE *p)
24 {
25   foo = *p;
26 }
27
28 jmp_buf failure;
29
30 void sig_handler(int sig)
31 {
32   longjmp(failure, 1);
33 }
34
35 int main(void)
36 {
37   long n[10];
38   int res;
39   signal(SIGSEGV, sig_handler);
40 #ifdef SIGBUS
41   signal(SIGBUS, sig_handler);
42 #endif
43   if(setjmp(failure) == 0) {
44     access_int64((ARCH_INT64_TYPE *) n);
45     access_int64((ARCH_INT64_TYPE *) (n+1));
46     res = 0;
47   } else {
48     res = 1;
49   }
50   signal(SIGSEGV, SIG_DFL);
51 #ifdef SIGBUS
52   signal(SIGBUS, SIG_DFL);
53 #endif
54   exit(res);
55 }
56