Skip Menu |

This queue is for tickets about the Math-Random-MT-Auto CPAN distribution.

Report information
The Basics
Id: 78584
Status: resolved
Priority: 0/
Queue: Math-Random-MT-Auto

People
Owner: Nobody in particular
Requestors: SLAFFAN [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 6.18
Fixed in: 6.19



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.

Added check for vector size mismatches that indicate architecture differences, and returns an exception if so detected. On 2012-07-26 09:26:09, SLAFFAN wrote: Show quoted text
> I am getting seg faults when initialising a new MRMA object but using
a Show quoted text
> 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 Show quoted text
> 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 Show quoted text
> the same starting conditions, and cause non-replication of results for
a Show quoted text
> 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 Show quoted text
> for a given seed value anyway (although maybe one could add an option
to Show quoted text
> allow the use of a 32 bit implementation on a 64 bit machine). > > Regards, > Shawn Laffan.