Apologize to re-opening this old thread. I tried Joe's
patch on the current J source and it seems working. But
it also crashed when running g640 in the test suite.
I can get a simple repeatable expression that caused crash.

?@:(5e3&$)"0 ] 2

but 1e3 or 2e3 is ok.  Any idea?

Чт, 17 дек 2015, Joe Bogner написал(а):
> looks like the problem likes in
> https://github.com/openj/core/blob/18fd23bbdc2f50770eb3047e978cd5e4e3b47039/vrand.c#L726
> 
> It looks like it checks to see if the first number in the list is 2
> and if so, it uses the roll2 implementation
> 
> RZ(w=vi(w)); m=*AV(w);
> if( 2==m)RZ(z=roll2 (w,&b));
> 
> It also appears to be a 64-bit bug
> 
> 32-bit:
> 
>    ?. 16 # 2 2 2 16
> 1 0 0 1 0 1 0 0 0 0 1 0 1 0 0 0 0 0 1 0 0 0 0 1 1 1 0 0 1 1 0 0 0 1 1
> 1 1 1 1 0 1 1 1 0 0 1 1 1 13 12 13 4 9 15 5 9 6 3 9 1 2 11 1 8
> 
> 64-bit
>       ?. 16 # 2 2 2 16
> 0 1 0 1 1 0 0 1 1 1 0 0 0 0 1 0 0 1 0 1 1 0 0 0 0 0 1 0 0 1 0 1 0 0 0
> 0 0 0 1 0 1 1 1 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 1 1 1 0 1 1
> 
> The simplest 'fix' would be to disable the roll 2 optimization by
> commenting it out, but that may not be ideal since presumably it was
> put in place for a reason to speed up random booleans on large arrays.
> The next fix would be to check to see if all numbers in the ravel are
> 2 and only then use roll2. The last, probably more complicated fix
> would be to support 2 and other numbers in roll2 safely in 64-bit, but
> even that is pretty simple
> 
> 
> just copy and paste the block of shifts (since there is only 8), to
> add 8 more for 64-bit... need to do this for the random and fixed seed
> part
> 
>  }else for(j=0;j<q;++j){
>   t=NEXT;
>   if(!(2==*v++&&2==*v++&&2==*v++&&2==*v++))R mark; *zv++=mk&t; t>>=1;
>   if(!(2==*v++&&2==*v++&&2==*v++&&2==*v++))R mark; *zv++=mk&t; t>>=1;
>   if(!(2==*v++&&2==*v++&&2==*v++&&2==*v++))R mark; *zv++=mk&t; t>>=1;
>   if(!(2==*v++&&2==*v++&&2==*v++&&2==*v++))R mark; *zv++=mk&t; t>>=1;
>   if(!(2==*v++&&2==*v++&&2==*v++&&2==*v++))R mark; *zv++=mk&t; t>>=1;
>   if(!(2==*v++&&2==*v++&&2==*v++&&2==*v++))R mark; *zv++=mk&t; t>>=1;
>   if(!(2==*v++&&2==*v++&&2==*v++&&2==*v++))R mark; *zv++=mk&t; t>>=1;
>   if(!(2==*v++&&2==*v++&&2==*v++&&2==*v++))R mark; *zv++=mk&t;
> 
>  //start new code
>   #if SY_64
>   t>>=1;
>   if(!(2==*v++&&2==*v++&&2==*v++&&2==*v++))R mark; *zv++=mk&t; t>>=1;
>   if (!(2 == *v++ && 2 == *v++ && 2 == *v++ && 2 == *v++))R mark;
> *zv++ = mk&t; t >>= 1;
>   if (!(2 == *v++ && 2 == *v++ && 2 == *v++ && 2 == *v++))R mark;
> *zv++ = mk&t; t >>= 1;
>   if (!(2 == *v++ && 2 == *v++ && 2 == *v++ && 2 == *v++))R mark;
> *zv++ = mk&t; t >>= 1;
>   if (!(2 == *v++ && 2 == *v++ && 2 == *v++ && 2 == *v++))R mark;
> *zv++ = mk&t; t >>= 1;
>   if (!(2 == *v++ && 2 == *v++ && 2 == *v++ && 2 == *v++))R mark;
> *zv++ = mk&t; t >>= 1;
>   if (!(2 == *v++ && 2 == *v++ && 2 == *v++ && 2 == *v++))R mark;
> *zv++ = mk&t; t >>= 1;
>   if (!(2 == *v++ && 2 == *v++ && 2 == *v++ && 2 == *v++))R mark; *zv++ = 
> mk&t;
>   #endif
>  }
> 
> On Thu, Dec 17, 2015 at 10:29 PM, Linda A Alvord
> <[email protected]> wrote:
> > These are the results you should get in a fresh version of JHS or jqt.  If
> > you use ?. you will insure repeated exact results in a session. In all cases
> > the length of the list is 64 elements so there should be enough 2's.
> >
> > ?. 16 # 2 2 2 16
> > 1 0 0 1 0 1 0 0 0 0 1 0 1 0 0 0 0 0 1 0 0 0 0 1 1 1 0 0 1 1 0 0 0 1 1 1 1 1
> > 1 0 1 1 1 0 0 1 1 1 13 12 13 4 9 15 5 9 6 3 9 1 2 11 1 8
> >    ?. 16 # 3 2 2 16
> > 0 2 2 1 2 0 2 1 1 2 0 2 1 1 1 2 0 0 0 0 1 0 0 0 0 1 1 1 0 0 1 1 0 0 0 1 1 1
> > 1 1 1 0 1 1 1 0 0 1 13 11 13 12 13 4 9 15 5 9 6 3 9 1 2 11
> >    ?. 16 # 16 2 2 2
> > 2 11 15 4 6 7 4 1 4 2 6 14 1 14 7 12 0 0 0 0 1 0 0 0 0 1 1 1 0 0 1 1 0 0 0 1
> > 1 1 1 1 1 0 1 1 1 0 0 1 1 1 1 0 1 0 1 1 1 1 0 1 1 1 0 1
> >
> >    $?. 16 # 2 2 2 16
> > 64
> >    $?. 16 # 3 2 2 16
> > 64
> >    $?. 16 # 16 2 2 2
> > 64
> >
> > Linda
> >
> > -----Original Message-----
> > From: [email protected]
> > [mailto:[email protected]] On Behalf Of 'Pascal
> > Jasmin' via Programming
> > Sent: Thursday, December 17, 2015 12:41 PM
> > To: [email protected]
> > Subject: Re: [Jprogramming] bug in ?
> >
> > ?.  2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
> > 2 2 2 2 2 2 2 2 2 2 2 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16
> > 0 0 0 0 1 1 0 0 0 1 1 1 0 0 0 0 1 0 0 0 0 1 1 1 1 1 1 0 1 1 1 0 1 0 1 1 1 1
> > 0 1 1 1 1 0 0 1 1 1 8 9 6 8 14 7 12 9 1 15 2 15 3 13 3
> >
> > ?. 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
> > 2 2 2 2 2 2 2 2 2 2 2 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16
> > 0 1 0 1 1 0 0 1 1 1 0 0 0 0 1 0 0 1 0 1 1 0 0 0 0 0 1 0 0 1 0 1 0 0 0 0 0 0
> > 1 0 1 1 1 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 1 1 1 0 1 1
> >
> >
> > one less leading 2 in first example.  47 leading 2s, correct result.  48
> > leading 2s and everything is 2.
> >
> >
> > ----- Original Message -----
> > From: Raul Miller <[email protected]>
> > To: Programming forum <[email protected]>
> > Sent: Thursday, December 17, 2015 12:28 PM
> > Subject: Re: [Jprogramming] bug in ?
> >
> > Consider
> >    ?.2 2 2 32
> > 0 1 0 18
> >
> > Thanks,
> >
> > --
> > Raul
> >
> >
> > On Thu, Dec 17, 2015 at 12:13 PM, 'Pascal Jasmin' via Programming
> > <[email protected]> wrote:
> >>
> >>
> >>
> >> ?. 16 # 2 2 2 16
> >>
> >>
> >> result is same as
> >>
> >> ?. 16 # 2 2 2 2
> >>
> >> ignores the request for 0-15 range random numbers.
> >>
> >>
> >> ----- Original Message -----
> >> From: Raul Miller <[email protected]>
> >> To: Programming forum <[email protected]>
> >> Sent: Thursday, December 17, 2015 12:10 PM
> >> Subject: Re: [Jprogramming] bug in ?
> >>
> >> On Thu, Dec 17, 2015 at 11:49 AM, 'Pascal Jasmin' via Programming
> >> <[email protected]> wrote:
> >>> ?. 16 # 2 2 2 16
> >>> 0 1 0 1 1 0 0 1 1 1 0 0 0 0 1 0 0 1 0 1 1 0 0 0 0 0 1 0 0 1 0 1 0 0 0 0 0
> > 0 1 0 1 1 1 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 1 1 1 0 1 1
> >>>
> >>>
> >>> ?. 16 # 3 2 2 16
> >>> 0 2 1 0 2 1 1 1 2 1 0 2 1 2 1 2 1 0 1 1 1 1 1 1 0 0 1 0 0 1 1 0 0 1 1 1 0
> > 1 0 0 0 1 1 1 1 0 1 0 8 4 14 3 1 6 14 10 15 13 5 6 2 14 0 5
> >>>
> >>> The last 16 numbers in the first example should match the 2nd.
> >>
> >> Why do you say that?
> >>
> >> Thanks,
> >>
> >> --
> >> Raul
> >>
> >>
> >>
> >> ----------------------------------------------------------------------
> >> For information about J forums see http://www.jsoftware.com/forums.htm
> >
> >
> >
> >> ----------------------------------------------------------------------
> >> For information about J forums see http://www.jsoftware.com/forums.htm
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> >
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm

-- 
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
gpg --keyserver subkeys.pgp.net --armor --export 4434BAB3
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to