I believe I have found and fixed the bug.

The problem is in 2 f/\y , implemented by infix2 in file ap.c.
by the expression (}:y) f (}.y) .  In certain cases, instead
of explicitly doing }:y and }.y, the code constructs 
headers which point to the same data, thereby saving
time and space.  The fix is to make the condition for the 
"certain cases" more stringent, viz., when f is a primitive
atomic function.  This more stringent condition still
covers 100.0% of the practically useful cases.

Now if somebody demonstrates cases where 2 f/\y fails
even for f an atomic function (+ - * >. etc.), I would 
dispense with the optimization, and just do (}:y) f (}.y).

Thanks to everyone who contributed to the resolution
of this bug.



----- Original Message -----
From: Roger Hui <[email protected]>
Date: Monday, May 16, 2011 17:10
Subject: Re: [Jgeneral] Incorrect results in j701 - small testcase
To: General forum <[email protected]>

> I can reproduce this in the VC++ debugger and I will
> investigate further.  Thanks for the simple repro.
> 
> 
> 
> ----- Original Message -----
> From: bill lam <[email protected]>
> Date: Monday, May 16, 2011 16:00
> Subject: Re: [Jgeneral] Incorrect results in j701 - small testcase
> To: [email protected]
> 
> > It can be further trimmed down, in a clean session,
> >    b=: 2 ]/\ 3 2$0 4 0 2 2 2
> >    smoutput b
> >          
> > 0          0
> > 2147483647 2147483647
> > 
> > Пнд, 16 Май 2011, Henry Rich писал(а):
> > > I have cut this down to the following:
> > > 
> > > smoutput >: ] , 1000> |  b =: 2 ]/\ 0 1 2 { 3 2$ 0 4 0 2 
> > 2 2
> > > smoutput b
> > > 
> > > On my machine (J602) this produces the output
> > > 2 2 2 2
> > >           
> > 0          0
> > > 2147483647 2147483647
> > > 
> > > If you get rid of anything, it doesn't produce the obvious 
> > error.  I 
> > > have no idea where the corruption occurs.
> > > 
> > > Henry Rich
> > > 
> > > 
> > > On 5/16/2011 5:48 PM, Arthur Anger wrote:
> > > > On Sun, 15 May 2011 10:34:16 -0400, Eric 
> > Iverson<[email protected]>> > wrote:
> > > > . . .
> > > >> The simplest demonstration of the bug starting with a 
> clean 
> > J session
> > > >> would help. bdysegs probably means something to those who 
> > have been
> > > >> following closely, but it would be far better to have the 
> > complete set
> > > >> of simple statements in a clean start (jconsole if 
> > possible) that show
> > > >> the bug.
> > > > . . .
> > > > ----------------
> > > > The simple demonstration I have now found points to two 
> > conditions:> > --use of ]/\
> > > > --execution during load
> > > >
> > > > The script:
> > > > smoutput 'Redisplay bb and bx after load.'
> > > > smoutput 'bb: ', ": bb=: 2 ]/\ i. 10
> > > > smoutput 'bx: ', ": bx=: 2 ] \ i. 10
> > > >
> > > > The console log:
> > > > Last login: Mon May 16 09:47:14 on ttys000
> > > > /Applications/j701/bin/jconsole ; exit;
> > > > AAMac:~ Anger$ /Applications/j701/bin/jconsole ; exit;
> > > >     ] bb=: 2 ]/\ i. 10
> > > > 1 2 3 4 5 6 7 8 9
> > > >     bb
> > > > 1 2 3 4 5 6 7 8 9
> > > >     smoutput bb
> > > > 1 2 3 4 5 6 7 8 9
> > > >     load '/Users/Anger/j602-user/bad2.ijs'
> > > > Redisplay bb and bx after load.
> > > > bb: 1 2 3 4 5 6 7 8 9
> > > > bx:
> > > > 0 1
> > > > 1 2
> > > > 2 3
> > > > 3 4
> > > > 4 5
> > > > 5 6
> > > > 6 7
> > > > 7 8
> > > > 8 9
> > > >     bb
> > > > 1 825303088 540160544 874525491 892674100 540423712 
> > 941635383 3743800 0
> > > >     bx
> > > > 0 1
> > > > 1 2
> > > > 2 3
> > > > 3 4
> > > > 4 5
> > > > 5 6
> > > > 6 7
> > > > 7 8
> > > > 8 9

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to