English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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