segmentation fault in warehouse test
Closed this issue · 5 comments
Jean-Luc-Picard-2021 commented
Got a segmentation fault in a warehouse test:
$ ./tpl -v
Trealla Prolog (c) Infradig 2020-2023, v2.50.35
$ ./tpl
?- ['bench2.p'].
true.
?- time(test).
Segmentation fault
The test case reads:
:- dynamic(foo/2).
test :-
retractall(foo(_,_)),
warehouse(1000000, 1, 18884).
warehouse(0, _, _) :- !.
warehouse(N, X, Y) :-
assertz(foo(Y, bar)),
(retract(foo(X, bar)) -> true; true),
zx81(X, Z), zx81(Y, T),
M is N-1,
warehouse(M, Z, T).
zx81(X, Y) :- Y is (X*75+74) mod 65537.
flexoron commented
Strange enough I get the segfault with this:
$ tpl
?- time(test).
% Time elapsed 4.133s, 11000004 Inferences, 2.662 MLips
true.
?- time(test).
Segmentation fault (core dumped)
$
but not if applied so:
$ tpl
?- test.
true.
?- test.
true.
?- test.
true.
?- test.
true.
?- time(test).
% Time elapsed 4.391s, 11000004 Inferences, 2.505 MLips
true.
?- time(test).
% Time elapsed 4.437s, 11000004 Inferences, 2.479 MLips
true.
?- time(test).
% Time elapsed 4.416s, 11000004 Inferences, 2.491 MLips
true.
?- time(test).
% Time elapsed 4.451s, 11000004 Inferences, 2.471 MLips
true.
?-
infradig commented
I was getting it intermittently.
…On Thu, Apr 25, 2024 at 10:42 PM flexoron ***@***.***> wrote:
Strange enough I get the segfault with this:
$ tpl
?- time(test).
% Time elapsed 4.133s, 11000004 Inferences, 2.662 MLips
true.
?- time(test).
Segmentation fault (core dumped)
$
but not if applied so:
$ tpl
?- test.
true.
?- test.
true.
?- test.
true.
?- test.
true.
?- time(test).
% Time elapsed 4.391s, 11000004 Inferences, 2.505 MLips
true.
?- time(test).
% Time elapsed 4.437s, 11000004 Inferences, 2.479 MLips
true.
?- time(test).
% Time elapsed 4.416s, 11000004 Inferences, 2.491 MLips
true.
?- time(test).
% Time elapsed 4.451s, 11000004 Inferences, 2.471 MLips
true.
?-
—
Reply to this email directly, view it on GitHub
<#529 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFNKSER7HML2ZVXU7UDKM3LY7D2ZXAVCNFSM6AAAAABGYMC6FGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANZXGA4DSOBYHA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
infradig commented
Using retractall/1 instead of retract/1 seems to fix. Not sure why it would be different as there is only every 1 retracted.
EDIT: oops no, still seems to crash after enough iterations.
infradig commented
Any reason you re-opened this?
Jean-Luc-Picard-2021 commented
I errorneously closed it, and then in an instance I reopened it.
But it runs now fine on my side:
$ ./tpl -v
Trealla Prolog (c) Infradig 2020-2023, v2.51.8-5-gbcb2
$ ./tpl
?- ['bench.p'].
true.
?- time(test).
% Time elapsed 4.259s, 11000004 Inferences, 2.583 MLips
true.
?- time(test).
% Time elapsed 4.168s, 11000004 Inferences, 2.639 MLips
true.