From: "Richard W.M. Jones" <rich@annexia.org>
To: caml-list@inria.fr
Subject: [Caml-list] ppc64le behaviour of Int64.min_int ÷ -1
Date: Mon, 29 Jun 2015 18:50:26 +0100 [thread overview]
Message-ID: <20150629175026.GE31462@annexia.org> (raw)
Downstream bug: https://bugzilla.redhat.com/show_bug.cgi?id=1236615
OCaml expects Int64.min_int ÷ -1 to overflow and wrap around
(resulting in Int64.min_int). There is also a test case in the test
suite for this. See this previously fixed bug:
http://caml.inria.fr/mantis/view.php?id=5513
The compiler seems to cater for the case where an overflow in the
division throws an exception.
Unfortunately ppc64le does neither of these things: On ppc64le the
result of the computation is explicitly undefined, it sets a flag bit
(OV), but it doesn't throw an exception.
[See page 76 of
https://www.power.org/wp-content/uploads/2013/05/PowerISA_V2.07_PUBLIC.pdf ]
I wonder if there is a way to tell the compiler about this? I could
add a conditional branch, but that would make the expansion of every
Int64.div and Int64.rem quite large (but maybe that doesn't matter as
these functions are going to be slow anyway?)
Suggestions welcome ...
Rich.
--
Richard Jones
Red Hat
next reply other threads:[~2015-06-29 17:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-29 17:50 Richard W.M. Jones [this message]
2015-06-29 18:00 ` Xavier Leroy
2015-06-29 18:08 ` Richard W.M. Jones
2015-06-29 18:15 ` Richard W.M. Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150629175026.GE31462@annexia.org \
--to=rich@annexia.org \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox