caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] "dangling" exception in native code.
@ 2002-12-23 10:34 Artem Prisyznuk
  0 siblings, 0 replies; only message in thread
From: Artem Prisyznuk @ 2002-12-23 10:34 UTC (permalink / raw)
  To: caml-list, caml-bugs

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-12-23 10:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-23 10:34 [Caml-list] "dangling" exception in native code Artem Prisyznuk

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