diff options
-rw-r--r-- | testasmcomp/alpha.asm | 15 | ||||
-rw-r--r-- | testasmcomp/main.c | 6 | ||||
-rw-r--r-- | testasmcomp/mainarith.c | 6 |
3 files changed, 27 insertions, 0 deletions
diff --git a/testasmcomp/alpha.asm b/testasmcomp/alpha.asm index 9f7992a6c..2bb1a2686 100644 --- a/testasmcomp/alpha.asm +++ b/testasmcomp/alpha.asm @@ -58,3 +58,18 @@ caml_c_call: ret ($26) .end caml_c_call + +/* Glue code to jump to array_bound_error after reinitializing $gp */ + + .globl call_array_bound_error + .ent call_array_bound_error + .align 3 +call_array_bound_error: + /* Rebuild $gp */ + br $27, $106 +$106: ldgp $gp, 0($27) + /* Branch to array_bound_error -- never returns */ + jsr array_bound_error + + .end call_array_bound_error + diff --git a/testasmcomp/main.c b/testasmcomp/main.c index feeea9ff4..8a83bdacc 100644 --- a/testasmcomp/main.c +++ b/testasmcomp/main.c @@ -13,6 +13,12 @@ #include <stdio.h> +void array_bound_error() +{ + fprintf(stderr, "Fatal error: out-of-bound access in array or string\n"); + exit(2); +} + #ifdef SORT long cmpint(i, j) diff --git a/testasmcomp/mainarith.c b/testasmcomp/mainarith.c index f53f2d967..9262acc52 100644 --- a/testasmcomp/mainarith.c +++ b/testasmcomp/mainarith.c @@ -13,6 +13,12 @@ #include <stdio.h> +void array_bound_error() +{ + fprintf(stderr, "Fatal error: out-of-bound access in array or string\n"); + exit(2); +} + long r[100]; double d[10]; long x, y; |