From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.0 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 47575BC6B for ; Mon, 26 Nov 2007 18:56:30 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAAaXSkfRVca4kmdsb2JhbACPQQEBAQEHAgYTFg X-IronPort-AV: E=Sophos;i="4.21,468,1188770400"; d="scan'208";a="6197783" Received: from concorde.inria.fr ([192.93.2.39]) by mail3-smtp-sop.national.inria.fr with ESMTP; 26 Nov 2007 18:56:30 +0100 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id lAQHuTcQ005080 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Mon, 26 Nov 2007 18:56:29 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAAaXSkfRVca4kmdsb2JhbACPQQEBAQEHAgYTFg X-IronPort-AV: E=Sophos;i="4.21,468,1188770400"; d="scan'208";a="6197781" Received: from rv-out-0910.google.com ([209.85.198.184]) by mail3-smtp-sop.national.inria.fr with ESMTP; 26 Nov 2007 18:56:28 +0100 Received: by rv-out-0910.google.com with SMTP id f5so568750rvb for ; Mon, 26 Nov 2007 09:56:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=oc9LfIDoZa2BBLTf9Brfb1tMorLYCzOhvGKcjlueg8M=; b=ukR+6evubcMSZj+AGPIUwa0gwOCiWSQogKx5tiFPvti3Ixxs7wl+vnBLh0KmhRduKJMd2R1E5YIjxU5Wa4DdLBi5F/lu/L2eubMdAuuw827JJqN74ZuP1b8H9bXbcuRuU9J8p1fH8Y/g9AKoY7MlcSEYg81YEGPXCCjDodroBj8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=B3dVxjRCUttLu4Mu57d/GdQMIsBJ65bOk0KqXkIBUR7nl5RVn1vT/Hb7nz8o9j/72WAjSm6+qax1jv1TpQWb0Gx42AugoxJYIBSFKrzD6jDB2WELasCdzTA8hN/RE9U8zdwTH/bcUe9t9VpJMKz1UzuctTRit6OyRUCy5Q+7DSs= Received: by 10.141.162.16 with SMTP id p16mr1314533rvo.1196099787437; Mon, 26 Nov 2007 09:56:27 -0800 (PST) Received: by 10.140.200.16 with HTTP; Mon, 26 Nov 2007 09:56:27 -0800 (PST) Message-ID: <90823c940711260956r137e8abdg83f03969c8fece6a@mail.gmail.com> Date: Mon, 26 Nov 2007 20:56:27 +0300 From: "Dmitry Bely" To: "Sebastien Ferre" Subject: Re: [Caml-list] Floating exception Cc: ocaml In-Reply-To: <474B019F.90102@irisa.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <47471716.3020304@irisa.fr> <1195900308.7242.19.camel@localhost> <474B019F.90102@irisa.fr> X-Miltered: at concorde with ID 474B08CD.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; irisa:01 gcc:01 ocaml:01 runtime:01 ocaml:01 pervasives:01 const:01 underflow:01 argv:01 flags:01 compiler:01 bug:01 runtime:01 26,:98 14.:98 On Nov 26, 2007 8:25 PM, Sebastien Ferre wrote: > I've got the same problem with the simplest program, > the "hello world" : > > let _ = print_string "Hello world!\n" > > > * Machine where compiled (in native code): > > Linux version 2.6.20-1.2952.fc6 > (brewbuilder@ls20-bc1-14.build.redhat.com) (gcc > version 4.1.1 20070105 (Red Hat 4.1.1-51)) #1 SMP Wed May 16 18:59:18 > EDT 2007 > Intel(R) Core(TM) Duo CPU U2500 @ 1.20GHz > > > * Machine where execution produces "Floating exception" It could be Ocaml runtime initialization. I've faced it under Windows then loaded Ocaml DLL from Borland C-compiled program. The problem was that Pervasives.infinity let infinity = float_of_bits 0x7F_F0_00_00_00_00_00_00L expects (due to float_of_bits) FP control word to be set some specific way otherwise floating-point exception will occur. I worked around it as follows: const unsigned newState =_EM_DENORMAL| _EM_INEXACT|_EM_UNDERFLOW|_EM_OVERFLOW|EM_ZERODIVIDE|_EM_INVALID; unsigned oldState = _control87(newState, _MCW_EM); caml_startup(argv); _control87(oldState, _MCW_EM); (Don't remember which flags are really necessary - I just duplicated the default MSVC compiler state that worked) Probably this is Ocaml bug as its runtime should not depend on the default state of FP control word and should set in explicitly. - Dmitry Bely