Skip to content

Commit

Permalink
Bug in multiple allocation
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryHRich committed Oct 10, 2024
1 parent 3387691 commit 8ba619f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion jsrc/ar.c
Original file line number Diff line number Diff line change
Expand Up @@ -1217,7 +1217,7 @@ static DF2(jtfoldx){F2PREFIP;A z,vz;
zzalloc=2*zzalloc+(AKXR(1)>>LGSZI); // new allocation, cacheline multiple
A zznew; GATV0E(zznew,INT,zzalloc,1,goto exitpop;) A *zznewzap=AZAPLOC(zznew); A *zzzap=AZAPLOC(zz); // allocate, & get pointers to tstack slots old & new
JMC(AAV1(zznew),AAV1(zz),newslot<<LGSZI,0) AT(zz)=INT; AFLAG(zz)=0; *zzzap=zznew; *zznewzap=zz; zz=zznew; // swap buffers, transferring ownership to zznew & protecting it, neutering zz, setting zz to be freed
AT(zz)=BOX; AFLAG(zz)=BOX&RECURSIBLE; // new zz now has pointers to allocated blocks
AZAPLOC(zz)=zzzap; AT(zz)=BOX; AFLAG(zz)=BOX&RECURSIBLE; // new zz now has pointers to allocated blocks and to its dedicated zaploc
}
AAV1(zz)[newslot]=z; AN(zz)=newslot+1; // install the new value & account for it in len
}else{
Expand Down
2 changes: 1 addition & 1 deletion test/gfold.ijs
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@ NB. one item - dyad


NB. F. F:
102 51 154 77 232 116 58 29 88 44 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 -: ([ _2 Z: 1 = {:) F. (, -:`(1 3&p.)@.(2&|)@{:) 102
51 154 77 232 116 58 29 88 44 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 -: (([ _2 Z: 1 = ])@{:) F: (, -:`(1 3&p.)@.(2&|)@{:) 102
102 51 154 77 232 116 58 29 88 44 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 -: ([ _2 Z: 1 = {: [ _1 Z: 88 = {:) F. (, -:`(1 3&p.)@.(2&|)@{:) 102
51 154 77 232 116 58 29 44 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 -: (([ _2 Z: 1 = ] [ _1 Z: 88 = {:)@{:) F: (, -:`(1 3&p.)@.(2&|)@{:) 102
102 51 154 77 232 116 58 29 88 44 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 -: ([ _2 Z: 1 = {:) F. (([ 0 Z: 88 = {:)@(, -:`(1 3&p.)@.(2&|)@{:)) 102
51 154 77 232 116 58 29 44 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 -: (([ _2 Z: 1 = ])@{:) F: (([ 0 Z: 88 = {:)@(, -:`(1 3&p.)@.(2&|)@{:)) 102
102 51 154 77 232 116 58 29 -: ([ 0 Z: 88 = {:) F. (([ 1 Z: 88 = {:)@(, -:`(1 3&p.)@.(2&|)@{:)) 102
51 154 77 232 116 58 29 -: (([ 0 Z: 88 = ])@{:) F: (([ 1 Z: 88 = {:)@(, -:`(1 3&p.)@.(2&|)@{:)) 102
949 = # ([ _2 Z: 1 = {:) F. (, -:`(1 3&p.)@.(2&|)@{:) 63728127 NB. many reallocs
NB. empty result
'no result' -: ([ _2 Z: 51 = {:) F: (, -:`(1 3&p.)@.(2&|)@{:) etx 102
'no result' -: ([ _2 Z: 51 = {:) F. (, -:`(1 3&p.)@.(2&|)@{:) etx 102
Expand Down

0 comments on commit 8ba619f

Please sign in to comment.