Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Overflow causes crash in Int32 division
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2006-05-04 (01:37)
From: Andy Chou <andy@c...>
Subject: Overflow causes crash in Int32 division
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 Chou
Coverity, Inc.
185 Berry St. Suite 3600
San Francisco, CA 94107
Phone: 415-321-5203
Fax: 415-541-9521