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 949FEBBBC for ; Sat, 22 Jul 2006 21:18:49 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k6MJInMq028126 for ; Sat, 22 Jul 2006 21:18:49 +0200 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 VAA05804 for ; Sat, 22 Jul 2006 21:18:48 +0200 (MET DST) Received: from mail.gmx.net (mail.gmx.net [213.165.64.21]) by nez-perce.inria.fr (8.13.6/8.13.6) with SMTP id k6MJIlx6028123 for ; Sat, 22 Jul 2006 21:18:48 +0200 Received: (qmail invoked by alias); 22 Jul 2006 19:18:47 -0000 Received: from p54A30C23.dip0.t-ipconnect.de (EHLO [192.168.2.10]) [84.163.12.35] by mail.gmx.net (mp030) with SMTP; 22 Jul 2006 21:18:47 +0200 X-Authenticated: #20477425 From: Michael Wohlwend To: caml-list@inria.fr Subject: compiler question Date: Sat, 22 Jul 2006 21:19:15 +0200 User-Agent: KMail/1.9.1 X-Face: S)[vu%Bha1d&ej9GfwAq~7C}A,y[B.uS}+D6'hb~xPwsxymw$fnCOaMe<*bnUajSBR_m?R @V3;iX8[A}z`.%pEQ1r7iZhN8#ktTCBQ}&mkx>=RH&l|l6\]NZI@ MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200607222119.15681.micha-1@fantasymail.de> X-Y-GMX-Trusted: 0 X-Miltered: at nez-perce with ID 44C27A19.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 44C27A17.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; compiler:01 byte:01 bytecode:01 compilers:01 native-code:01 bytecode:01 computed:01 cheers:01 exception:01 native:02 match:02 allocated:02 seems:03 bytes:03 let:03 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 Hi, I executed the following code, the array a0 was allocated to match the filesize and get32 reads 4 bytes via input_byte: let idx = ref 0 in try while true do a0.(!idx) <-get32 file; incr idx; done with End_of_file -> close_in file; this code works as bytecode but gives an array exception when compiled to native code. Is the execution order different on the two compilers? The a0. (!idx) get evaluted before the get32 in native-code, but with bytecode the get32 is computed first (it seems). The code works if I add a temporary variable like: let t = get32 file in a0.(!idx) <- t; is this a feature ? :-) cheers, Michael