One more reply to Raul… I thought to place a new statement JUST before the call 
to safeshow that triggers the assert in the originating stack frame…

Revised code:

===================
safeshow=: 3 :0
 assert. 0 < N=:N-1
 z=. ''
 assert. 1=#$z
 echo #$z
 'l r'=. y{Kid
 if. l<#Kid do.
   z=. '(',(safeshow l),') '
   assert. 1=#$z
   echo #$z
 end.
 z=. z,(":y{Key),':','BR'{~y{Red
 assert. 1=#$z
 echo #$z
 if. r<#Kid do.
   echo 'z=‘;z                        NB. The only new line
   z=. z,' (',(safeshow r),')'
   assert. 1=#$z
   echo #$z
 end.
)

Kid=: 1 2,_ 1,:_ _
Key=: 94 48 92
Red=: 0 1 1
N=: 3
===================

Repeating your steps under DEBUG I would expect to see the same value restored… 
but do not…

Output of running the revised function
   safeshow 0
1
1
1
┌──┬──┐
│z=.  │48:R│
└──┴──┘

Then after cutting back the stack in debug mode
====================
     z
48:R
(
     a. i. z
52 56 58 82
32 40 32 32
32 32 32 32
=====================

This IMHO demonstrates that z was corrupted via the Cut Back in Debug mode.

…/Rob

> On 15 Jun 2022, at 6:02 pm, Martin Kreuzer <[email protected]> wrote:
> 
> Thanks a lot, Rob ...
> 
> My results from JQt v9.03 seem to agree with yours:
> 
> ----------------------------------------
>   z
> 48:R
> (
>   $z
> 3 4
>   <"1 z
> 48:R (
>   a. I. z
> 52 56 58 82
> 32 40 32 32
> 32 32 32 32
> ----------------------------------------
>   JVERSION
> Engine: j903/j64avx2/windows
> Release-a: commercial/2021-12-16T15:15:09
> Library: 9.03.08
> Qt IDE: 1.9.5/5.15.2(5.15.2)
> Platform: Win 64
> Installer: J903 install
> InstallPath: d:/program files (non-sys)/j903
> Contact: www.jsoftware.com
> ----------------------------------------
> 
> ... and also for N=: 2
> ----------------------------------------
>   z
> ((
> )
>   $z
> 2 2
>   <"1 z
> (( )
>   a. I. z
> 40 40
> 41 32
> ----------------------------------------
> 
> - M
> 
> At 2022-06-15 07:01, you wrote:
> 
>> I get the same result as you Martin to just run <safeshow 0>.
>> 
>> However I think Raul’s query is what he describes if he first activates 
>> Debug mode (Ctrl-K) BEFORE running safeshow 0, then the Assert triggers 
>> debug (the debug input has focus),
>> Then you can cutback the stack and inspect ‘z’ in the J session.
>> 
>> Raul, here is what I see also, perhaps same as you ?
>> 
>> =================
>>      z
>> 48:R
>> 
>>     $z
>> 3 4
>>     <"1 z
>> ┌────┬────┬────┐
>> │48:R│ ( │ │
>> └────┴────┴────┘
>>     a. I. z
>> 52 56 58 82
>> 32 40 32 32
>> 32 32 32 32
>> =================
>> 
>>      JVERSION
>> Engine: j902/j64avx2/darwin
>> Beta-l: commercial/2020-11-05T14:07:25
>> Library: 9.02.08
>> Qt IDE: 1.8.7/5.12.7(5.12.7)
>> Platform: Darwin 64
>> Installer: J902 install
>> InstallPath: /users/rob/j902
>> Contact: www.jsoftware.com
>> 
>> > On 15 Jun 2022, at 4:54 pm, Martin Kreuzer <[email protected]> wrote:
>> >
>> > ... and this from v8.07 (all three tests were run in JConsole):
>> >
>> > ------------------------------------------------------------
>> >   Kid=: 1 2,_ 1,:_ _
>> >   Key=: 94 48 92
>> >   Red=: 0 1 1
>> >   N=: 3
>> >   safeshow 0
>> > 1
>> > 1
>> > 1
>> > |assertion failure: safeshow
>> > |   0    <N=:N-1
>> >
>> >   JVERSION
>> > Engine: j807/j64nonavx/windows
>> > Release-d: commercial/2019-03-18T13:16:44
>> > Library: 8.07.26
>> > Platform: Win 64
>> > Installer: J807 install
>> > InstallPath: d:/program files (non-sys)/j64-807-nonavx
>> > Contact: www.jsoftware.com
>> > ------------------------------------------------------------
>> >
>> > - M
>> >
>> >
>> > At 2022-06-15 06:02, you wrote:
>> >
>> >> I am running into a problem, in J903 and J904 -- I haven't yet
>> >> installed earlier versions of J on this machine.
>> >>
>> >> safeshow=: 3 :0
>> >>  assert. 0 < N=:N-1
>> >>  z=. ''
>> >>  assert. 1=#$z
>> >>  echo #$z
>> >>  'l r'=. y{Kid
>> >>  if. l<#Kid do.
>> >>    z=. '(',(safeshow l),') '
>> >>    assert. 1=#$z
>> >>    echo #$z
>> >>  end.
>> >>  z=. z,(":y{Key),':','BR'{~y{Red
>> >>  assert. 1=#$z
>> >>  echo #$z
>> >>  if. r<#Kid do.
>> >>    z=. z,' (',(safeshow r),')'
>> >>    assert. 1=#$z
>> >>    echo #$z
>> >>  end.
>> >>
>> >>
>> >>   Kid=: 1 2,_ 1,:_ _
>> >>   Key=: 94 48 92
>> >>   Red=: 0 1 1
>> >>   N=: 3
>> >>   safeshow 0
>> >>
>> >>
>> >>
>> >> |assertion failure: safeshow
>> >>
>> >> Now, there's a problem here with my data which triggers the assertion
>> >> -- Kid should not contain any duplicate values other than _. But
>> >> that's not what I am concerned with here.
>> >>
>> >> In Jqt, I enable debugging (control-K) and when the debugger pops up
>> >> on the assert, I go back to the previous stack frame, and I find that
>> >> z has rank 2, instead of rank 1.
>> >>
>> >> Specifically, it has the value '48:R',' (',:' '
>> >>
>> >> So, now I am trying to figure out what's gone wrong.
>> >>
>> >> Conceptually, I could accept that z was being modified by virtual
>> >> block handling -- except there's no update to z which would have given
>> >> it a rank 2 value.
>> >>
>> >> Another possibility here is that there's something specifically wrong
>> >> with my machine. So: can anyone else reproduce this issue?
>> >>
>> >> And, ... the next most likely possibility is that there's something
>> >> wrong with the J engine itself.
>> >>
>> >> Anyways, I'd like to get someone else's perspective here.
>> >>
>> >> 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

Reply via email to