Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005575OCamlOCaml standard librarypublic2012-04-06 12:132013-04-09 14:04
Reporterlealanko 
Assigned Todoligez 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version3.12.1 
Target VersionFixed in Version4.00.0+dev 
Summary0005575: Random states are not marshallable across architectures
DescriptionAlthough the Random module is designed so that it produces the same output on all architectures, the internal representation of a random state depends on the architecture: on 64-bit architectures, the state array contains some values that won't fit into an int on 32-bit architectures. Hence a Random.State.t from a 64-bit system cannot be marshalled and then unmarshalled on a 32-bit system.

This is trivial to fix: just add "land 0x3FFFFFFF" before storing a value in the state array.
Steps To ReproduceOn 64-bit:

# Marshal.to_string (Random.State.make [||]) [];;
- : string =
"\132\149\166\190\000\000\001~\000\000\000\002\000\000\000;\000\000\000;\160\b\000\000\220\000\003\000\000\000\000\196\146\178\147\003\000\000\000\000\228FXM\002Q'\236\001\002f\239\t\161\002X\195\177F\002P\127W\144\0024r\149\203\003\000\000\000\000\139\133Ro\002K\146K|\002s\196\192)\003\000\000\000\000\173\178\021\209\002\b\194`\202\003\000\000\000\000\152\137\186\224\003\000\000\000\000\231e\228\246\002r,,6\002yv\150\244\003\000\000\000\000\250\224\233T\003\000\000\000\000\135}\182\205\003\000\000\000\000\209\168V.\003\000\000\000\000\146\210t\176\002lo`\025\003\000\000\000\000\255H8\199\002\017\243\136\188\002HPJx\003\000\000\000\000\228\207*n\002(\184\177Q\003\000\000\000\000\185}\186U\002\015k\206 \003\000\000\000\000\233>\185\222\002-\149\197\194\003\000\000\000\000\243\215[\186\0022=%\138\002-\231\218\025\002g\244\133Z\003\000\000\000\000\169\248\132\202\002d\235+\170\002n\217\147\149\002_\185$!\002c\137\162\200\002:\135fo\002X}\180U\003\000\000\000\000\164[u\234\002G\179\234=\003\000\000\000\000\230\156r\019\003\000\000\000\000\155\252\162\255\003\000\000\000\000\245b9\021\003\000\000\000\000\246\254\198\152\002\t\158R\222\002T\210%\205\003\000\000\000\000\203\252\207\213\003\000\000\000\000\233\011P\219\003\000\000\000\000\171\206\143'\003\000\000\000\000\133\244V\151\002+\"\145\165\002\020\139\169\031@"

On 32-bit:

# let s : Random.State.t = Marshal.from_string "\132\149\166\190\000\000\001~\000\000\000\002\000\000\000;\000\000\000;\160\b\000\000\220\000\003\000\000\000\000\196\146\178\147\003\000\000\000\000\228FXM\002Q'\236\001\002f\239\t\161\002X\195\177F\002P\127W\144\0024r\149\203\003\000\000\000\000\139\133Ro\002K\146K|\002s\196\192)\003\000\000\000\000\173\178\021\209\002\b\194`\202\003\000\000\000\000\152\137\186\224\003\000\000\000\000\231e\228\246\002r,,6\002yv\150\244\003\000\000\000\000\250\224\233T\003\000\000\000\000\135}\182\205\003\000\000\000\000\209\168V.\003\000\000\000\000\146\210t\176\002lo`\025\003\000\000\000\000\255H8\199\002\017\243\136\188\002HPJx\003\000\000\000\000\228\207*n\002(\184\177Q\003\000\000\000\000\185}\186U\002\015k\206 \003\000\000\000\000\233>\185\222\002-\149\197\194\003\000\000\000\000\243\215[\186\0022=%\138\002-\231\218\025\002g\244\133Z\003\000\000\000\000\169\248\132\202\002d\235+\170\002n\217\147\149\002_\185$!\002c\137\162\200\002:\135fo\002X}\180U\003\000\000\000\000\164[u\234\002G\179\234=\003\000\000\000\000\230\156r\019\003\000\000\000\000\155\252\162\255\003\000\000\000\000\245b9\021\003\000\000\000\000\246\254\198\152\002\t\158R\222\002T\210%\205\003\000\000\000\000\203\252\207\213\003\000\000\000\000\233\011P\219\003\000\000\000\000\171\206\143'\003\000\000\000\000\133\244V\151\002+\"\145\165\002\020\139\169\031@" 0;;
    Exception: Failure "input_value: integer too large".

TagsNo tags attached.
Attached Files

- Relationships
related to 0005977resolvedfrisch Build failure on raspberry pi: "input_value: integer too large" 

-  Notes
(0007312)
doligez (administrator)
2012-04-10 17:33

Fixed in version 4.00 (commit 12333) and trunk (commit 12335).

- Issue History
Date Modified Username Field Change
2012-04-06 12:13 lealanko New Issue
2012-04-10 16:10 doligez Assigned To => doligez
2012-04-10 16:10 doligez Status new => assigned
2012-04-10 17:33 doligez Note Added: 0007312
2012-04-10 17:33 doligez Status assigned => closed
2012-04-10 17:33 doligez Resolution open => fixed
2012-04-10 17:33 doligez Fixed in Version => 4.00.0+dev
2013-04-09 14:04 frisch Relationship added related to 0005977


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker