caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] ppc64le behaviour of Int64.min_int ÷ -1
@ 2015-06-29 17:50 Richard W.M. Jones
  2015-06-29 18:00 ` Xavier Leroy
  0 siblings, 1 reply; 4+ messages in thread
From: Richard W.M. Jones @ 2015-06-29 17:50 UTC (permalink / raw)
  To: caml-list

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-06-29 18:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-29 17:50 [Caml-list] ppc64le behaviour of Int64.min_int ÷ -1 Richard W.M. Jones
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).