Skip to content

Commit

Permalink
Merge pull request #766 from frankluebeck/fix_remove_with_holes
Browse files Browse the repository at this point in the history
Fix kernel method for 'Remove' with one argument
  • Loading branch information
markuspf committed Apr 29, 2016
2 parents 64f99d9 + 89dd011 commit cd4afab
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/listfunc.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,10 @@ Obj RemPlist (
}
removed = ELM_PLIST(list, pos);
SET_ELM_PLIST(list, pos, (Obj)0L);
SET_LEN_PLIST(list, pos-1);
if ( pos == 1 ) {
pos--;
while ( 1 <= pos && ELM_PLIST( list, pos ) == 0 ) { pos--; }
SET_LEN_PLIST(list, pos);
if ( pos == 0 ) {
RetypeBag(list, T_PLIST_EMPTY);
}
if (4*pos*sizeof(Obj) < 3*SIZE_BAG(list))
Expand Down
17 changes: 17 additions & 0 deletions tst/teststandard/bugfix.tst
Original file line number Diff line number Diff line change
Expand Up @@ -3045,6 +3045,23 @@ gap> Size(Stabilizer(g, [ [1,2], [3,4] ], OnSetsSets));
gap> G:=Group((1,2,3,4));;Factorization(G,Elements(G)[1]);
<identity ...>

#2016/04/27 (FL, bug reported on support list)
gap> l := [1,,,5];;
gap> Remove(l);
5
gap> [l, Length(l)];
[ [ 1 ], 1 ]
gap> l := [,,,"x"];;
gap> Remove(l);
"x"
gap> [l, Length(l)];
[ [ ], 0 ]
gap> l := [1,2,,[],"x"];;
gap> Remove(l);
"x"
gap> [l, Length(l)];
[ [ 1, 2,, [ ] ], 4 ]

#############################################################################
gap> STOP_TEST( "bugfix.tst", 831990000);

Expand Down

0 comments on commit cd4afab

Please sign in to comment.