Skip to content

Commit

Permalink
Update bug.pl
Browse files Browse the repository at this point in the history
  • Loading branch information
sasagawa888 committed Nov 12, 2024
1 parent 09189f9 commit 659af31
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
15 changes: 4 additions & 11 deletions library/compiler.pl
Original file line number Diff line number Diff line change
Expand Up @@ -550,24 +550,17 @@
write('if((res=Jexec_all(Jaddtail_body(rest,body),Jget_sp())) == YES)'),nl,
write('return(YES);'),nl,
write('Junbind(save2);'),nl,
write('Jset_wp(save1);body;}'),nl.
write('Jset_wp(save1);}'),nl.

jump_gen_after_body(X,N) :-
write('{body = '),
jump_gen_body1(X,N),
write(';'),nl,
write('if((Jexec_all(Jaddtail_body(rest,body),Jget_sp())) == YES)'),nl,
write('return(YES);'),nl,
write('else return(NO);}'),nl.

jump_gen_after_body(X,N) :-
write('{body = '),
jump_gen_body1(X,N),
write(';'),nl,
write('if((Jexec_all(Jaddtail_body(rest,body),Jget_sp())) == YES)'),nl,
write('return(YES);'),nl,
write('else return(NO);}'),nl.

write('Junbind(save2);'),nl,
write('Jset_wp(save1);'),nl,
write('return(NO);}'),nl.


jump_gen_body1([],N) :-
Expand Down
17 changes: 12 additions & 5 deletions tests/bug.pl
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
% Quicksort
qsort([X|L], R, R0) :-
partition(L, X, L1, L2),
qsort(L2, R1, R0),
qsort(L1, R, [X|R1]).
qsort([], R, R) :- !.

% Partition list for quicksort
partition([X|L], Y, [X|L1], L2) :-
X < Y, !, partition(L, Y, L1, L2).
partition([X|L], Y, L1, [X|L2]) :-
!,partition(L, Y, L1, L2).
partition([], _ , [], []) :- !.

test5 :-
true,true,(fail;true),true.

test6 :-
true,true,(fail;fail),true.

0 comments on commit 659af31

Please sign in to comment.