Subject: | seg faults when initialised with state from different architecture |
I am getting seg faults when initialising a new MRMA object but using a
state generated on a different architecture.
This is occurring on Windows (ActivePerl 5.8.9 32 bit, Strawberry Perl
5.14.2 64 bit), but I would guess that it affects other systems.
To reproduce:
1. Initialise a new MRMA object on a 32 bit system.
2. Store the state.
3. Initialise a new MRMA object on a 64 bit system, using the state
from step 2.
A seg fault results, with the windows error "Perl command line has
stopped working".
The reverse also applies (initialise on 64 bit, store state, initialise
on 32 bit).
I have no issues if I stay on the same architecture.
A code example is attached to replicate.
For extra info, I get to line 200 in MRMA when stepping in with the
debugger, but not consistently. Sometimes I can step a few lines
further before the seg fault.
MRMA is one of my work-horse modules, so it would be good if it were
dealt with soon.
One possible way of handling this issue is to throw an exception when
initialising with a state containing integers from a different
architecture. The alternative of padding or truncating the integers
would result in a different PRNG sequence for what the user believes is
the same starting conditions, and cause non-replication of results for a
given starting state on differing architectures. As noted in the POD,
the 64 bit system does not return the same sequence as the 32 bit system
for a given seed value anyway (although maybe one could add an option to
allow the use of a 32 bit implementation on a 64 bit machine).
Regards,
Shawn Laffan.
Subject: | prng_32_64_fatals.pl |
Message body is not shown because it is too large.