Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Int64.div causes floating point exception #5513

Closed
vicuna opened this issue Feb 23, 2012 · 2 comments

Comments

Projects
None yet
2 participants
@vicuna
Copy link

commented Feb 23, 2012

Original bug ID: 5513
Reporter: cyocum
Assigned to: @xavierleroy
Status: closed (set by @xavierleroy on 2013-08-31T10:48:37Z)
Resolution: fixed
Priority: normal
Severity: major
Platform: GNU/Linux
OS: XUbuntu
OS Version: 11.10
Version: 3.12.1
Fixed in version: 3.13.0+dev
Category: back end (clambda to assembly)
Related to: #4740

Bug description

The code attached compiles. However, when run, it causes a Floating Point exception when it shouldn't. This happens on both 3.12.0 and a compiled 3.12.1 system on XUbuntu.

Steps to reproduce

let a = -9223372036854775808L
let b = -1L
let c = Int64.div a b

let _ = ()

@vicuna

This comment has been minimized.

Copy link
Author

commented Feb 23, 2012

Comment author: @xavierleroy

I gather this is observed with ocamlopt on an x86-64 platform. The x86 "idiv" instruction unhelpfully raises a division error when computing min_int / -1 instead of returning min_int as we want. The bytecode interpreter and the runtime system were hardened against this behavior (see #4740) but not the native-code compiler.

@vicuna

This comment has been minimized.

Copy link
Author

commented Feb 24, 2012

Comment author: @xavierleroy

Fixed in SVN trunk, commit 12187.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.