diff --git a/stdlib/pervasives.ml b/stdlib/pervasives.ml index 1ae6765a2..1904da847 100644 --- a/stdlib/pervasives.ml +++ b/stdlib/pervasives.ml @@ -21,7 +21,7 @@ let failwith s = raise(Failure s) let invalid_arg s = raise(Invalid_argument s) exception Exit -exception Assert_failure of string * int * int +exception Assert_failure of (string * int * int) (* Comparisons *) diff --git a/stdlib/pervasives.mli b/stdlib/pervasives.mli index bed85812b..2f352ed7d 100644 --- a/stdlib/pervasives.mli +++ b/stdlib/pervasives.mli @@ -53,12 +53,12 @@ type 'a option = None | Some of 'a external raise : exn -> 'a = "%raise" (* Raise the given exception value *) -(*- exception Match_failure of string * int * int *) +(*- exception Match_failure of (string * int * int) *) (* Exception raised when none of the cases of a pattern-matching apply. The arguments are the location of the pattern-matching in the source code (file name, position of first character, position of last character). *) -exception Assert_failure of string * int * int +exception Assert_failure of (string * int * int) (* Exception raised when an assertion fails. The arguments are the location of the pattern-matching in the source code (file name, position of first character, position of last @@ -75,6 +75,10 @@ exception Assert_failure of string * int * int (*- exception Out_of_memory *) (* Exception raised by the garbage collector when there is insufficient memory to complete the computation. *) +(*- exception Stack_overflow *) + (* Exception raised by the bytecode interpreter when the evaluation + stack reaches its maximal size. This often indicates infinite + or excessively deep recursion in the user's program. *) (*- exception Sys_error of string *) (* Exception raised by the input/output functions to report an operating system error. *) diff --git a/stdlib/printexc.ml b/stdlib/printexc.ml index 842088be2..359bfbbdc 100644 --- a/stdlib/printexc.ml +++ b/stdlib/printexc.ml @@ -21,6 +21,8 @@ let prerr_loc file first_char last_char msg = let print_exn = function Out_of_memory -> prerr_string "Out of memory\n" + | Stack_overflow -> + prerr_string "Stack overflow\n" | Match_failure(file, first_char, last_char) -> prerr_loc file first_char last_char "Pattern matching failed"; | Assert_failure(file, first_char, last_char) ->