[MLton] Bug: Word64.ror with offset 0w32 fails on x86
Wesley W. Terpstra
wesley at terpstra.ca
Mon Sep 14 12:07:26 PDT 2009
val x = valOf (Word64.fromString "1234567890abcdef")
val y = MLton.Word64.ror (x, 0w32)
val z = Word64.orb (Word64.<< (x, 0w32), Word64.>> (x, 0w32))
val () = print (Word64.toString y ^ "\n")
val () = print (Word64.toString z ^ "\n")
Output:
1234567890ABCDEF
90ABCDEF12345678
Expected output:
90ABCDEF12345678
90ABCDEF12345678
I've checked that this bug is NOT from gcc by compiling the following:
#include <stdint.h>
#include <stdio.h>
uint64_t Word64_ror(uint64_t w1, uint32_t w2);
int main () {
uint64_t x = Word64_ror(0x1234567890ABCDEFUL, 32);
printf ("%llX\n", x);
return 0;
}
gcc -Wall -O2 bug.c /usr/lib/mlton/self/libmlton.a -o bug
Output:
90ABCDEF12345678
The number 0w32 strikes me as a case that someone probably optimized
incorrectly.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mlton.org/pipermail/mlton/attachments/20090914/50a1e3f8/attachment.htm
More information about the MLton
mailing list