diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 1995-12-05 09:16:53 +0000 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 1995-12-05 09:16:53 +0000 |
commit | c34a58a12edf215cba39e2a57a1890a84d9db476 (patch) | |
tree | 5cdf9e5f4716f726be2196de0c4d74173969be71 | |
parent | 87651e58b8475d48a66a6120c23bec61781c8c91 (diff) |
Ajout d'un test pour checkbound.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@502 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r-- | testasmcomp/Makefile | 3 | ||||
-rw-r--r-- | testasmcomp/checkbound.cmm | 20 | ||||
-rw-r--r-- | testasmcomp/main.c | 22 |
3 files changed, 45 insertions, 0 deletions
diff --git a/testasmcomp/Makefile b/testasmcomp/Makefile index cded95148..de3d5c90d 100644 --- a/testasmcomp/Makefile +++ b/testasmcomp/Makefile @@ -103,6 +103,9 @@ tagged-integr.out: main.c tagged-integr.o $(ARCH).o arith.out: mainarith.c arith.o $(ARCH).o $(CC) $(CFLAGS) -o arith.out mainarith.c arith.o $(ARCH).o +checkbound.out: main.c checkbound.o $(ARCH).o + $(CC) $(CFLAGS) -o checkbound.out -DCHECKBOUND main.c checkbound.o $(ARCH).o + .SUFFIXES: .SUFFIXES: .cmm .c .o .asm .S .ml .mli .cmo .cmi diff --git a/testasmcomp/checkbound.cmm b/testasmcomp/checkbound.cmm new file mode 100644 index 000000000..9beade6ef --- /dev/null +++ b/testasmcomp/checkbound.cmm @@ -0,0 +1,20 @@ +(***********************************************************************) +(* *) +(* Caml Special Light *) +(* *) +(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) +(* *) +(* Copyright 1995 Institut National de Recherche en Informatique et *) +(* Automatique. Distributed only by permission. *) +(* *) +(***********************************************************************) + +(* $Id$ *) + +(function "checkbound2" (x: int y: int) + (checkbound x y)) + +(function "checkbound1" (x: int) + (checkbound x 2)) + + diff --git a/testasmcomp/main.c b/testasmcomp/main.c index eecd117fa..feeea9ff4 100644 --- a/testasmcomp/main.c +++ b/testasmcomp/main.c @@ -77,5 +77,27 @@ int main(argc, argv) } #endif #endif +#ifdef CHECKBOUND + { extern void checkbound1(), checkbound2(); + extern void call_gen_code(); + long x, y; + x = atoi(argv[1]); + if (argc >= 3) { + y = atoi(argv[2]); + if ((unsigned long) x < (unsigned long) y) + printf("Should not trap\n"); + else + printf("Should trap\n"); + call_gen_code(checkbound2, y, x); + } else { + if (2 < (unsigned long) x) + printf("Should not trap\n"); + else + printf("Should trap\n"); + call_gen_code(checkbound1, x); + } + printf("OK\n"); + } +#endif return 0; } |