From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id WAA26435; Mon, 10 Jun 2002 22:04:00 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id WAA26656 for ; Mon, 10 Jun 2002 22:03:59 +0200 (MET DST) Received: from mail.speakeasy.net (mail17.speakeasy.net [216.254.0.217]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g5AK3vb04793 for ; Mon, 10 Jun 2002 22:03:58 +0200 (MET DST) Received: (qmail 22902 invoked from network); 10 Jun 2002 20:03:55 -0000 Received: from unknown (HELO harry) ([64.81.246.34]) (envelope-sender ) by mail17.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 10 Jun 2002 20:03:55 -0000 Message-ID: <00c601c210ba$07de5d10$0200a8c0@harry> From: "Harry Chomsky" To: "Caml-list" Subject: [Caml-list] Status of callback_exn bug Date: Mon, 10 Jun 2002 13:04:29 -0700 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_00C3_01C2107F.5B470FF0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk This is a multi-part message in MIME format. ------=_NextPart_000_00C3_01C2107F.5B470FF0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit I am having trouble using callback_exn -- my program crashes in bytecode mode, but works ok if I use the native-code compiler. I saw a message in the archive discussing a problem like this: http://caml.inria.fr/archives/200204/msg00065.html The CVS shows a change to byterun/interp.c on April 12 that appears to be related to this problem. I've tried to apply this change to my own copy of OCaml, but my program still crashes. Sometimes it runs a little bit longer than it did before, but it still crashes within the next few function calls. Was the April 12 fix supposed to resolve the problem completely? I'm enclosing a small program that demonstrates the problem. When prompted for a string, if you type "hello" the OCaml code will raise an exception, and the program will crash shortly thereafter. The timing of the crash varies depending whether you use "loop" or "loop1" as the main program loop. (I'm running OCaml 3.04, native Win32 port, on Windows 2000.) ------=_NextPart_000_00C3_01C2107F.5B470FF0 Content-Type: application/octet-stream; name="build.bat" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="build.bat" ocamlc -custom -o exn.exe exn.ml exn_c.c ocamlopt -o exnopt.exe exn.ml exn_c.c ------=_NextPart_000_00C3_01C2107F.5B470FF0 Content-Type: application/octet-stream; name="exn.ml" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="exn.ml" external do_it : (string -> unit) -> unit = "do_it" let f s = print_endline ("Caml says you entered " ^ s); flush stdout; if s = "hello" then failwith "Oops" let rec loop () = print_endline "Spot 1"; flush stdout; do_it f; print_endline "Spot 2"; flush stdout; loop () let loop1 () = while true do print_endline "Spot 1"; flush stdout; do_it f; print_endline "Spot 2"; flush stdout done let _ = loop1 () ------=_NextPart_000_00C3_01C2107F.5B470FF0 Content-Type: application/octet-stream; name="exn_c.c" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="exn_c.c" #include #include #include #include #include #include CAMLprim value do_it(value func) { CAMLparam1(func); char s[256]; CAMLlocal2(v, result); printf("Enter a string: "); scanf("%s", s); printf("C says you entered %s\n", s); v = copy_string(s); result = callback_exn(func, v); if (Is_exception_result(result)) printf("Caught exception\n"); CAMLreturn(Val_unit); } ------=_NextPart_000_00C3_01C2107F.5B470FF0-- ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners