RE Boss wrote:
>  If I rebuild the example in
>  ~/help/jforc/loopless_code_vii_sequential.htm#_Toc167755760
>  with (5;s;m;0 _1 0 0) ;: 'qqq0x30x30x40x0x34a' J602abeta crashes.

Roger responded:

>  Please provide a sequence of phrases that leads to a crash.

This is a slippery one.  It'll crash if the offending line is displayed in the 
session:

           m =. a. e. '0x123456789abcdefABCDEF'
           m =. m + a. e. '0x'
           m =. m + a. e. '0'
           
           s =. 1 4 2 $ 0 0 0 0 0 0 1 1
           s =. s , 4 2 $ 0 0 0 0 2 0 0 0
           s =. s , 4 2 $ 0 0 3 0 0 0 3 0
           s =. s , 4 2 $ 0 3 3 0 0 3 3 0
           
           1!:2&2 (5;s;m;0 _1 0 0) ;: 'qqq0x30x30x40x0x34a'

The final  1!:2&2  is superflous if these lines are entered in the IJX window 
verbatim, instead of running from a script.  Similarly if they're run from a 
script through the Run>Window Display  mechanism.  

Interestingly, in immex, assigning the result and displaying it does not cause 
a crash:

           Q =: (5;s;m;0 _1 0 0) ;: 'qqq0x30x30x40x0x34a'

           Q
         0 _1 0 0 0 0
         1 _1 0 0 0 0
         2 _1 0 0 0 0
         ...

Nor will this crash if run from a script, UNLESS the script is run twice AND 
the assignment to Q is global.  That is, if the above text is saved into a 
script and  load  'd, it won't crash, until you  load  it again.  If you 
restart J and make the assignment to  Q  local, you may  load  the script 
multiple times without error.

I attempted to to formalize these rules in J code, but when I do I get strange 
behavior. 

           T =: 0 : 0
              m =. a. e. '0x123456789abcdefABCDEF'
              m =. m + a. e. '0x'
              m =. m + a. e. '0'
           
              s =. 1 4 2 $ 0 0 0 0 0 0 1 1
              s =. s , 4 2 $ 0 0 0 0 2 0 0 0
              s =. s , 4 2 $ 0 0 3 0 0 0 3 0
              s =. s , 4 2 $ 0 3 3 0 0 3 3 0
           
              Q =: (5;s;m;0 _1 0 0) ;: 'qqq0x30x30x40x0x34a'
        )
           
           3 : '0!:100 y' T    NB.  ok
        
           erase'Q'  
        1
           3 : '0!:100 y' T     NB.  Same sentence
        |spelling error
        |      
        
           Q
        |value error: Q
           
           T  NB.  Noun  T  has been trashed (shifted backwards in memory?).
        ??      m =. a. e. '0x123456789abcdefABCDEF'
              m =. m + a. e. '0x'
              m =. m + a. e. '0'
           
              s =. 1 4 2 $ 0 0 0 0 0 0 1 1
              s =. s , 4 2 $ 0 0 0 0 2 0 0 0
              s =. s , 4 2 $ 0 0 3 0 0 0 3 0
              s =. s , 4 2 $ 0 3 3 0 0 3 3 0
           
              Q =: (5;s;m;0 _

           T =: 'hello'  NB.  Including its header.
        |read-only data
        |   T    =:'hello'
           
These problems are not neccesarily reproducible, so I'm guessing somewhere 
along the line J's memory was corrupted.  But I can't pin down precisely when.  
The bug may be sensitive to  0~:13!:11 ''  (that is, whether an error has been 
raised during the session), but that's not definite either.  

-Dan

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

Reply via email to