From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id AE254BBC0 for ; Mon, 13 Mar 2006 19:53:33 +0100 (CET) Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.197]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id k2DIrW54029332 for ; Mon, 13 Mar 2006 19:53:33 +0100 Received: by xproxy.gmail.com with SMTP id i27so851301wxd for ; Mon, 13 Mar 2006 10:53:32 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=OFr58L0QiNrp3+YCuNy4t3ZII57G1cAmVyg6WSbsJB7UnGcKWAQw4qI67jCnlSKmvsWTsKgAMlFSi//KSvY5zCHoyZRdipBAiNQpJSr74DPDpiRIHYd2AkoKC/8V69JWqFAQrQV48EXivi5gbD2bzlW8Imjdk4NP/JBl7+ySZdM= Received: by 10.70.24.18 with SMTP id 18mr6588887wxx; Mon, 13 Mar 2006 10:53:32 -0800 (PST) Received: by 10.70.57.14 with HTTP; Mon, 13 Mar 2006 10:53:32 -0800 (PST) Message-ID: Date: Mon, 13 Mar 2006 13:53:32 -0500 From: "Markus Mottl" To: "Xavier Leroy" Subject: Re: [Caml-list] Allocating caml lists from C : possible bug on amd64 Cc: "=?ISO-8859-1?Q?\"Sayan_(S=E9bastien_Li-Thiao-T=E9)\"?=" , caml-list@yquem.inria.fr In-Reply-To: <4415AF18.5070404@inria.fr> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_4804_7988687.1142276012514" References: <440F556A.9010209@crans.org> <44158770.6000407@crans.org> <441595B8.3040203@crans.org> <4415AF18.5070404@inria.fr> X-Miltered: at nez-perce with ID 4415BFAC.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; markus:01 mottl:01 markus:01 mottl:01 allocating:01 bug:01 alloc:01 alloc:01 compiler:01 pointer:01 silently:01 compiler:01 pointer:01 silently:01 wrote:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=HTML_30_40,HTML_MESSAGE, RCVD_BY_IP autolearn=disabled version=3.0.3 ------=_Part_4804_7988687.1142276012514 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 3/13/06, Xavier Leroy wrote: > > You haven't declared caml_alloc (include ), so the C > compiler assumes it returns an int instead of a value, and generates > wrong code. Funny that I didn't spot this one. Good to know that one should look out for this problem when making sure that code remains portable to 64-bit machines. I think C-compilers should by default issue a warning on platforms where th= e size of int may be different from the size of a pointer instead of silently inventing a function prototype that is very likely to crash. Regards, Markus ------=_Part_4804_7988687.1142276012514 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 3/13/06, Xavier Leroy <Xavier.Leroy@inria.fr> wrote:
You haven't declared caml_alloc (include <caml/alloc.h>), so the Ccompiler assumes it returns an int instead of a value, and generates
wr= ong code.

Funny that I didn't spot this one.  Good to know that one should look out for this problem when making sure that code remains portable to 64-bit machines.

I think C-compilers should by default issue a warning on platforms where the size of int may be different from the size of a pointer instead of silently inventing a function prototype that is very likely to crash.

Regards,
Markus
------=_Part_4804_7988687.1142276012514--