summaryrefslogtreecommitdiffstats
path: root/testsuite/tests/runtime-errors/stackoverflow.ml
diff options
context:
space:
mode:
authorXavier Clerc <xavier.clerc@inria.fr>2010-01-25 14:26:23 +0000
committerXavier Clerc <xavier.clerc@inria.fr>2010-01-25 14:26:23 +0000
commit6d1cb50121da767ffdbcb647e0999723c43802c4 (patch)
tree0bdab3a6c2043b746fcf7ca3b4349942625a0cb7 /testsuite/tests/runtime-errors/stackoverflow.ml
parent6db7e05658c27b5fd7042cb2db725a12364d4aea (diff)
Tests moved to 'runtime-errors'
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@9581 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'testsuite/tests/runtime-errors/stackoverflow.ml')
-rw-r--r--testsuite/tests/runtime-errors/stackoverflow.ml15
1 files changed, 15 insertions, 0 deletions
diff --git a/testsuite/tests/runtime-errors/stackoverflow.ml b/testsuite/tests/runtime-errors/stackoverflow.ml
new file mode 100644
index 000000000..4d211bc82
--- /dev/null
+++ b/testsuite/tests/runtime-errors/stackoverflow.ml
@@ -0,0 +1,15 @@
+let rec f x =
+ if x land 0xFFFF <> 0
+ then 1 + f (x + 1)
+ else
+ try
+ 1 + f (x + 1)
+ with Stack_overflow ->
+ print_string "x = "; print_int x; print_newline();
+ raise Stack_overflow
+
+let _ =
+ try
+ ignore(f 0)
+ with Stack_overflow ->
+ print_string "Stack overflow caught"; print_newline()