caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Damien Doligez <damien.doligez@inria.fr>
To: Kaustuv Chaudhuri <kaustuv.chaudhuri@inria.fr>
Cc: caml-list caml-list <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] Converting variants with only constant constructors  to integers
Date: Mon, 23 Aug 2010 16:36:19 +0200	[thread overview]
Message-ID: <D298892D-4AB3-4FE1-9FE3-21CEBCF2BD00@inria.fr> (raw)
In-Reply-To: <AANLkTikRe85mNn83G8zU6JCQzjj2VkRlQQN1DOy1146q@mail.gmail.com>

Hi Kaustuv,

On 2010-06-08, at 20:22, Kaustuv Chaudhuri wrote:

>> Of course intify can cause a segmentation fault!
>> 
>> # let arr = Array.of_list [intify 1.0; 0];;
>> Segmentation fault
> 
> This may be splitting hairs, but the reason that fails is that
> Array.of_list's ad hoc polymorphism heuristic assumes that if the
> first element of the list is allocated, then all elements are
> allocated. Merely changing the order works.


Then again, good old addition has the same kind of problem with
intify.

$ ocaml
        Objective Caml version 3.12.0

# external intify : 'a -> int = "%identity";;
external intify : 'a -> int = "%identity"
# let x = 1 + intify (1, 2);;
val x : int = 2147734445
# Gc.minor ();;  
ocamlrun(11589) malloc: *** mmap(size=184834061894270976) failed (error code=12)
*** error: can't allocate region


-- Damien


      parent reply	other threads:[~2010-08-23 14:36 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-07 18:07 Török Edwin
2010-06-07 18:25 ` [Caml-list] " W Dan Meyer
2010-06-07 18:45   ` bluestorm
     [not found] ` <87sk4y7lc7.fsf@gmail.com>
     [not found]   ` <4C0D3B0F.4060502@gmail.com>
2010-06-07 18:32     ` Török Edwin
2010-06-07 18:50       ` W Dan Meyer
2010-06-07 18:48 ` David Allsopp
2010-06-07 19:46   ` Török Edwin
2010-06-07 19:56     ` bluestorm
2010-06-07 22:51       ` W Dan Meyer
2010-06-08  7:42         ` David Allsopp
2010-06-08  7:59           ` bluestorm
2010-06-08  9:14             ` David Allsopp
2010-06-08  9:36               ` Luc Maranget
2010-06-08  9:45                 ` David Allsopp
2010-06-08  9:51                   ` Luc Maranget
2010-06-08 10:21                     ` David Allsopp
2010-06-08 10:21                   ` Dario Teixeira
2010-06-08 11:28       ` Kaustuv Chaudhuri
2010-06-08 11:40         ` bluestorm
2010-06-08 14:37           ` Jacques Garrigue
2010-06-08 18:22             ` Kaustuv Chaudhuri
2010-06-09  1:34               ` Jacques Garrigue
2010-08-23 14:36               ` Damien Doligez [this message]

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=D298892D-4AB3-4FE1-9FE3-21CEBCF2BD00@inria.fr \
    --to=damien.doligez@inria.fr \
    --cc=caml-list@yquem.inria.fr \
    --cc=kaustuv.chaudhuri@inria.fr \
    /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).