Enclosed is a gzipped tar file containing program ind.p (298 lines.)
As is, the program goes into infinite recursion, but it works correctly if you comment out a âwritelnâ statement on line 248, (the statement before ***************...)
(gpc-20040516, Linux running on a Pentium 4 laptop.)
I apologize for the size of the example, but I have been unable to reproduce the problem with a smaller example, and I don't understand what is happening.
The following are lines 238 â 249 of the program.
...
function rcrsv_ind_st2(var g:relation; s:subset): subset;
{this one is not debugged yet. gives different result than rcrs2 for the
third fullerene}
var i,k,l,k1,k2 :integer;
nb,ind1,ind2 :subset;
iterations :integer=0; attribute (static);
begin
{writeln('top:'); diagnose_subset(s); stop_n_go;}
iterations := iterations+1;
writeln('iteration number:',iterations); {************ comment this out, and it works ********}
if not there_are_edges_in(s,g)
...
This particular code works correctly on DIGITAL Pascal, (after changing the syntax for the static variable declaration,) but âwritelnâ statements in âwrongâ (but different) places have the same effect there, also.
The program is hardwired to compute the largest independent set of a path with 2 vertices, and the output should be:
iteration number: 1
iteration number: 2
cardinality 1
0: 0
Is it possible that, under certain circumstances, âwritelnâ permanently changes register values, or some such? Or, is this necessarily a bug in the program?
I have not figured out how to use the debugger on this â I'm getting:
Die: DW_TAG_set_type (abbrev = 3, offset = 431)
has children: FALSE
attributes:
DW_AT_type (DW_FORM_ref4) constant: 53
Dwarf Error: Cannot find type of die [in module ...
I would appreciate any suggestions regarding what might be happening or how to debug it.
Thanks,
- Inga