scryer-prolog icon indicating copy to clipboard operation
scryer-prolog copied to clipboard

index out of bounds in a minimal example of clpz

Open mhemery opened this issue 2 years ago • 3 comments

minimal_example.txt

In the provided file I try to find a path in a graph while avoiding loop and keeping a record of the interest of the path. The crash/0 goal succeed at first but asking for the second possibility it crash with the following error :

hemery@portablepret:prolog$ ~/Téléchargements/scryer-prolog minimal_example.pl 
Warning: singleton variables Path, Interest at line 40 of minimal_example.pl
?- crash.
   true
;  thread 'main' panicked at src/machine/machine_state_impl.rs:71:26:
index out of bounds: the len is 588481 but the index is 588482
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I am working in an Ubuntu 20.04.6 and using the binary file of scryer_prolog downloaded from the webpage yesterday.

mhemery avatar Nov 10 '23 11:11 mhemery

Shorter:

:- use_module(library(clpz)).

arc(rome, paris).
arc(paris, palaiseau).

crash :-
   X = paris,
   (arc(X, Z) ; arc(Z, X)),
   Interest #= Interest_tempo + 1,
   false,
   Z=Interest_tempo.

:- initialization(crash).

ulrich@gupu:~/scryer$ /opt/gupu/scryer-prolog/target/release/scryer-prolog -f issue2154.pl
Warning: singleton variables Interest at line 5 of issue2154.pl
thread 'main' panicked at 'index out of bounds: the len is 586106 but the index is 586108', src/machine/machine_state_impl.rs:71:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


UWN avatar Nov 10 '23 15:11 UWN

Here is "yet another" (and I would say "slightly violent") path to a crash (segmentation fault), without the clpz library, inspired by the UWN's example above.

A file to consult:

crash :-
   A is B + 1,  % or: A is B + B, or: 2 is B + 1, etc.
   A = B.       % or simply: B., or C = B., or B = B., or B = 1., etc.

:- initialization(crash).

The command line and the crash result:

$ scryer-prolog -f crashing-is-easy.pl 
Chyba segmentácie (bol uložený výpis pamäte) [in English: "Segmentation fault (core dumped)"]

haijinSk avatar Nov 10 '23 19:11 haijinSk

@mhemery: Is this closable for you?

UWN avatar Nov 12 '23 14:11 UWN