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 UAA04053; Thu, 4 Dec 2003 20:05:53 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id UAA04267 for ; Thu, 4 Dec 2003 20:05:51 +0100 (MET) Received: from www.prophydentida.com (host66-243.pool8021.interbusiness.it [80.21.243.66]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id hB4J5o113346 for ; Thu, 4 Dec 2003 20:05:51 +0100 (MET) Received: from baretta.com (unknown [192.168.75.122]) by www.prophydentida.com (Postfix) with ESMTP id 53A1953AF2; Thu, 4 Dec 2003 21:47:19 +0100 (CET) Message-ID: <3FCF856D.5060101@baretta.com> Date: Thu, 04 Dec 2003 20:05:17 +0100 From: Alex Baretta User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031007 X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Eric C. Cooper" , ocaml Subject: Re: [Caml-list] Troubles with marshaled/unmarshaled exception References: <3FCF78E7.4080907@baretta.com> <20031204185113.GB10706@localhost> In-Reply-To: <20031204185113.GB10706@localhost> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Loop: caml-list@inria.fr X-Spam: no; 0.00; baretta:01 baretta:01 caml-list:01 marshaled:01 unmarshaled:01 3.07:01 val:01 val:01 incorrectly:01 segfaults:01 type-check:01 segfaults:01 compiler:01 caml:01 alex:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Eric C. Cooper wrote: > On Thu, Dec 04, 2003 at 07:11:51PM +0100, Alex Baretta wrote: > But something is indeed broken. Here's a slight variant of the above: > > Objective Caml version 3.07+2 > > # let e = Failure "test";; > val e : exn = Failure "test" > # let e' = Failure "test";; > val e' : exn = Failure "test" > # let e'' = Marshal.from_string (Marshal.to_string e []) 0;; > val e'' : 'a = > # e'' ^ "good-bye";; > Segmentation fault > There's nothing wrong here. Module Marshal is not type safe. If you use it incorrectly you cannot complain if your program segfaults. The value represented by e'' actually has type exn, however the compiler cannot know this because you are defining it through Marshal.from_xxxx, which is not type safe. This allows you to type-check e'' ^ "good-bye" which segfaults. Alex ------------------- 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