[CLAIR-devel] Another variable is misteriously de-instantiated

Roberto Bagnara bagnara at cs.unipr.it
Sun Dec 9 18:43:49 CET 2007


Hi there,

it is happening again, but this time garbage collection does
not seem to be involved.  The problem boils down to a fragment

	write('ACS_in = '), write(ACS_in), nl,
	acs_init(ACS_in),
	write('ACS_in = '), write(ACS_in), nl,

that prints

ACS_in = _L178
ACS_in = _L178

but the tracer says that acs_init/1 does instantiate its argument:

    Call: (10) write('ACS_in = ') ? creep
ACS_in =
    Exit: (10) write('ACS_in = ') ? creep
    Call: (10) write(_L178) ? creep
_L178
    Exit: (10) write(_L178) ? creep
    Call: (10) nl ? creep

    Exit: (10) nl ? creep
    Call: (10) cpm:acs_init(_L178) ? skip
    Exit: (10) cpm:acs_init(1654520) ? creep
    Call: (10) write('ACS_in = ') ? creep
ACS_in =
    Exit: (10) write('ACS_in = ') ? creep
    Call: (10) write(_L178) ? creep
_L178
    Exit: (10) write(_L178) ? creep
    Call: (10) nl ? creep

    Exit: (10) nl ? creep

In turn, acs_init/1 is written in C++ and its code is
(equivalent, modulo wrapper functions to):

extern "C" foreign_t
acs_init(term_t ACS_out) {
   try {
     if (!PL_is_variable(ACS_out))
       throw not_a_variable(ACS_out, __PRETTY_FUNCTION__);
     Abstract_Control_Structure* p
       = acs_factory.new_abstract_control_structure(true);
     PL_put_pointer(ACS_out, p);
     return TRUE;
   }
   // Catch C++ exceptions and turn them into Prolog exeptions.
   // The following code is not executed in the example above.
   catch (...) {
     ...
   }
}

Differently from the bug we discovered recently, using

	set_prolog_flag(trace_gc, true)

I do not see any trace of GC activity here.
What can I do to investigate the bug further?
Thanks,

    Roberto

-- 
Prof. Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:bagnara at cs.unipr.it

------------
For further info, please visit http://www.swi-prolog.org/

To unsubscribe, send a plaintext mail with "unsubscribe prolog <e-mail>"
in its body to majordomo at science.uva.nl




More information about the CLAIR-devel mailing list