caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Status of callback_exn bug
@ 2002-06-10 20:04 Harry Chomsky
  0 siblings, 0 replies; 3+ messages in thread
From: Harry Chomsky @ 2002-06-10 20:04 UTC (permalink / raw)
  To: Caml-list

[-- Attachment #1: Type: text/plain, Size: 976 bytes --]

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.)

[-- Attachment #2: build.bat --]
[-- Type: application/octet-stream, Size: 79 bytes --]

ocamlc -custom -o exn.exe exn.ml exn_c.c
ocamlopt -o exnopt.exe exn.ml exn_c.c

[-- Attachment #3: exn.ml --]
[-- Type: application/octet-stream, Size: 476 bytes --]

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 ()

[-- Attachment #4: exn_c.c --]
[-- Type: application/octet-stream, Size: 511 bytes --]

#include <caml/alloc.h>
#include <caml/callback.h>
#include <caml/custom.h>
#include <caml/fail.h>
#include <caml/memory.h>
#include <caml/mlvalues.h>

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);
}

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Status of callback_exn bug
  2002-07-11 17:28 Harry Chomsky
@ 2002-07-11 18:50 ` Harry Chomsky
  0 siblings, 0 replies; 3+ messages in thread
From: Harry Chomsky @ 2002-07-11 18:50 UTC (permalink / raw)
  To: Caml-list

Never mind -- I see that the problem has just been fixed!

----- Original Message -----
From: "Harry Chomsky" <harry@chomsky.net>
To: "Caml-list" <caml-list@inria.fr>
Sent: Thursday, July 11, 2002 10:28 AM
Subject: [Caml-list] Status of callback_exn bug


> With all the talk about an upcoming release of OCaml 3.05, I thought I
> should ask once more if anybody knows about the status of the callback_exn
> bug that was reported on April 12, 2002 in
>
> http://caml.inria.fr/archives/200204/msg00065.html
>
> The CVS shows that a change was made to byterun/interp.c on that date,
which
> appears to be intended to fix the problem, but for me the problem remains
> even with this fix.  Is it possible that version 3.05 will really fix the
> problem?  If there's still more tweaking to be done, is it possible that
it
> could get done in time to be included in the release?
>
> Thanks,
> Harry
>
>
> -------------------
> 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
>

-------------------
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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Caml-list] Status of callback_exn bug
@ 2002-07-11 17:28 Harry Chomsky
  2002-07-11 18:50 ` Harry Chomsky
  0 siblings, 1 reply; 3+ messages in thread
From: Harry Chomsky @ 2002-07-11 17:28 UTC (permalink / raw)
  To: Caml-list

With all the talk about an upcoming release of OCaml 3.05, I thought I
should ask once more if anybody knows about the status of the callback_exn
bug that was reported on April 12, 2002 in

http://caml.inria.fr/archives/200204/msg00065.html

The CVS shows that a change was made to byterun/interp.c on that date, which
appears to be intended to fix the problem, but for me the problem remains
even with this fix.  Is it possible that version 3.05 will really fix the
problem?  If there's still more tweaking to be done, is it possible that it
could get done in time to be included in the release?

Thanks,
Harry


-------------------
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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-07-11 18:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-10 20:04 [Caml-list] Status of callback_exn bug Harry Chomsky
2002-07-11 17:28 Harry Chomsky
2002-07-11 18:50 ` Harry Chomsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).