Ticket #23 (closed defect: fixed)

Opened 6 months ago

Last modified 6 months ago

Differents results when debug is enabled ...

Reported by: victor Owned by: pmoura
Priority: major Milestone: Logtalk distribution
Component: compiler Version: 2.32.1
Keywords: Cc:

Description

Hello,

I found this strange bug, using this predicate :

:- object(test2).
:- public(union/3).
mymemberchk(E, T) :-
  varlist::memberchk(E, T), !.
mymemberchk(E, T) :-
  list::member(E, T).

union([], L, L).
union([H|T], L, R) :-
  ( mymemberchk(H, L) *->
    union(T, L, R)
  ; union(T, L, R2),
    R = [H|R2]
  ).
:- end_object.
?- set_logtalk_flag(debug, on).
true.

?- logtalk_load(test2).
% test2.pl compiled 0.00 sec, 4,252 bytes
true.

?- test2::union([a], [a], R).
R = [a] ;
R = [a, a].

?- set_logtalk_flag(debug, off).
true.

?- logtalk_load(test2).
% test2.pl compiled 0.00 sec, -812 bytes
true.

?- test2::union([a], [a], R).
R = [a].

As you can see, when debug is on, union/3 backtracks in a strange way.

I tried to look at the trace, but I am not sure to understand what is happening :>

Attachments

Change History

Changed 6 months ago by pmoura

  • owner set to pmoura
  • status changed from new to assigned

The problem is likely due to the use of the non-standard construct *->/2.

Changed 6 months ago by pmoura

  • status changed from assigned to closed
  • resolution set to fixed

Problem corrected in r4401. Unfortunately, fixing this problem with non-standard control constructs implied incompatible changes to all config files.

Add/Change #23 (Differents results when debug is enabled ...)

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.