Re: segmentation fault writing cyclic term

Daniel Diaz <[email protected]> Fri, 10 Dec 2021 08:49:49 +0100
Newsgroups gmane.comp.gnu.prolog.bugs
Message-ID <[email protected]>
Hi Paul,

Acyclic terms are not supported but the predicate acyclic_term/1 if =
provided to test if a term is acyclic. You can use it before printing a =
term.
The top-level does this before printing a solution (else it emits the =
error message you mentioned).

Daniel


> Le 4 d=C3=A9c. 2021 =C3=A0 17:55, Paul Eggert <[email protected]> a =
=C3=A9crit :
>=20
> On 12/4/21 03:21, Paulo Moura wrote:
>>> | ?- X =3D X+1, write(X).
>>> X =3D X+1, write(X).
>>> Segmentation fault (core dumped)
>>>=20
>>>=20
>>> Shouldn't write/1 be protected against cyclic terms?
>> Note that support for cyclic terms is not a ISO Prolog standard =
requirement.
>=20
> Quite right, this is not a standards violation. Still, gprolog already =
defends against cyclic terms when it outputs them:
>=20
>  | ?- X=3DX+1.
>=20
>  cannot display cyclic term for X
>=20
> so presumably it could defend against them in 'write' if this was =
considered useful (which it would be, for my students...).
>=20