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 concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id F1EF2BB83 for ; Thu, 4 May 2006 03:37:00 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id k441b0Hr006124 for ; Thu, 4 May 2006 03:37:00 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id DAA02103 for ; Thu, 4 May 2006 03:36:59 +0200 (MET DST) Received: from coverity.dreamhost.com (supmuscle.dreamhost.com [66.33.192.105]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id k441awm8006115 for ; Thu, 4 May 2006 03:36:59 +0200 Received: from [10.0.0.27] (unknown [69.12.168.114]) by coverity.dreamhost.com (Postfix) with ESMTP id 097153ADDE for ; Wed, 3 May 2006 18:36:58 -0700 (PDT) Message-ID: <44595AC3.5060400@coverity.com> Date: Wed, 03 May 2006 18:37:07 -0700 From: Andy Chou User-Agent: Thunderbird 1.5.0.2 (Windows/20060308) MIME-Version: 1.0 To: caml-list@inria.fr Subject: Overflow causes crash in Int32 division Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 44595ABC.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 44595ABA.002 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; bytecode:01 printf:01 printf:01 nativeint:01 3600:98 int:01 int:01 native:02 div:97 seems:03 let:03 overflow:03 problem:05 problem:05 32.:05 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 I've noticed that the following causes a crash on both the bytecode interpreter and native code: open Int32 open Printf let _ = printf "%ld\n" (Int32.div Int32.min_int (-1l)) This doesn't appear to be documented, so I presume it's incorrect behavior. Nativeint also seems to have the same problem. The built-in int type doesn't seem to have the same problem. Int64 doesn't seem to have a problem either. This is on a 32-bit Windows platform. -Andy -- Andy Chou Coverity, Inc. 185 Berry St. Suite 3600 San Francisco, CA 94107 Phone: 415-321-5203 Fax: 415-541-9521