From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 1AEB07F787 for ; Mon, 7 Nov 2016 16:58:25 +0100 (CET) X-IronPort-AV: E=Sophos;i="5.31,606,1473112800"; d="scan'208";a="199500394" Received: from estephe.paris.inria.fr (HELO [128.93.64.229]) ([128.93.64.229]) by mail3-relais-sop.national.inria.fr with ESMTP; 07 Nov 2016 16:58:24 +0100 To: caml-list@inria.fr References: <20161107132201.GG27249@annexia.org> <20161107154843.GH27249@annexia.org> From: Xavier Leroy Message-ID: <6a64a161-4ed0-fb07-caa1-4bf3c7f91c23@inria.fr> Date: Mon, 7 Nov 2016 16:58:24 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <20161107154843.GH27249@annexia.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Caml-list] Zarith problems on ppc64le On 07/11/2016 16:48, Richard W.M. Jones wrote: > On Mon, Nov 07, 2016 at 01:22:01PM +0000, Richard W.M. Jones wrote: >> >> https://bugzilla.redhat.com/show_bug.cgi?id=1392247 >> >> Zarith fails tests on OCaml 4.04.0 + ppc64le with some fairly gross >> errors, eg: >> >> of_float -1. >> - = -1 >> + = 0 >> >> (It passes fine on OCaml 4.04.0 + ppc64) >> >> The implementation of Zarith is quite complex and I've so far failed >> to understand what's going on. > > FWIW this seems like it is invoking undefined behaviour in C. See > my analysis here: > > https://bugzilla.redhat.com/show_bug.cgi?id=1392247#c3 Yes, something is weird here. You can try to put return Val_long((intnat) x); on line 524: it should fix the issue that you suspect. If this is the source of the problem, I'm surprised that it doesn't break on other platforms as well. - Xavier Leroy