caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Artem Prisyznuk <temofey@gmx.net>
To: caml-list@inria.fr, caml-bugs@pauillac.inria.fr
Subject: [Caml-list] "dangling" exception in native code.
Date: Mon, 23 Dec 2002 12:34:19 +0200	[thread overview]
Message-ID: <20021223123419.6ca009a2.temofey@gmx.net> (raw)

Hello,

Next small example produce segfault for native code, but work ok in byte
code.

I use OCaml 3.06. I compile and run this example on Linux, Win98, and Cygwin
systems, result is same.


type s = { mutable exc : exn };;
        
let run max = begin
    let rec loop n acc = 
      if n > 0
      then
        let s = { exc = Not_found } in
        let f () =
          s.exc <- Failure (string_of_int n);
          raise Not_found
        in
        loop ( n - 1 ) ( (s, f) :: acc )
      else acc in
    print_endline "Make list"; flush_all ();
    let lst = loop max [] in
    print_endline "Iter 1"; flush_all ();
    List.iter 
      (fun (s,f) -> try f () with Not_found -> ()  ) 
      lst;
    print_endline "Iter 2"; flush_all ();
    List.iter 
      (fun (s,_) -> ignore(Printexc.to_string s.exc) ) 
      lst;
    print_endline "The End"; flush_all ()
    end;;
        
let _ = run 3000 ;;


-- 
Best Regards,
Artem Prisyanuk
tema@sit.kiev.ua
-------------------
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


                 reply	other threads:[~2002-12-23 10:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021223123419.6ca009a2.temofey@gmx.net \
    --to=temofey@gmx.net \
    --cc=caml-bugs@pauillac.inria.fr \
    --cc=caml-list@inria.fr \
    --cc=tema@sit.kiev.ua \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).