From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p7GFQAcX022624 for ; Tue, 16 Aug 2011 17:26:10 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EAOWLSk5QRFuw/2dsb2JhbABBqDR3gUABAQU6PxALGBwSFCghiAW5WoVpXwSkCA X-IronPort-AV: E=Sophos;i="4.67,380,1309730400"; d="scan'208";a="105601109" Received: from furbychan.cocan.org ([80.68.91.176]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/AES256-SHA; 16 Aug 2011 17:25:55 +0200 Received: from rich by furbychan.cocan.org with local (Exim 4.72) (envelope-from ) id 1QtLWY-0008He-5S; Tue, 16 Aug 2011 16:25:50 +0100 Date: Tue, 16 Aug 2011 16:25:50 +0100 From: "Richard W.M. Jones" To: Dmitry Bely Cc: Caml List Message-ID: <20110816152550.GA21081@annexia.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) Subject: Re: [Caml-list] Interfacing with C: bad practice On Tue, Aug 16, 2011 at 11:37:03AM +0400, Dmitry Bely wrote: > C compiler first puts "list" pointer on stack and then calls > caml_copy_string(*s), potentially invalidating "list". Of course, the > stack copy of "list" is not registered as a global root so wrp_ml_cons > gets an invalid value. I think this must be a bug in your C compiler. The address of list is stashed in the roots struct, so the C compiler should know that list can be changed by the call to caml_copy_string. What C compiler / version is this? Rich. -- Richard Jones Red Hat