On Thu, 3 Apr 2008, Riccardo (Jack) Lucchetti wrote:
More details: gretl gets stuck while trying to delete all the
temporary
variables created inside the function. It looks like we run into an infinite
loop in this section of lib/src/gretl_func.c (line numbers added for
clarity):
3536: for (i=orig_v; i<pdinfo->v; i++) {
3537: fprintf(stderr, "i = %d\n", i);
3538: if (STACK_LEVEL(pdinfo, i) == d) {
3539: anyerr = dataset_drop_variable(i--, pZ, pdinfo);
3540: if (anyerr && !err) {
3541: err = anyerr;
3542: }
3543: }
3544: }
The "i--" operation smells bad, but I'm not familiar enough with this
region
of the source to pin down what's wrong with it.
The following patch seems to fix things.
Index: lib/src/gretl_func.c
===================================================================
RCS file: /cvsroot/gretl/gretl/lib/src/gretl_func.c,v
retrieving revision 1.190
diff -u -r1.190 gretl_func.c
--- lib/src/gretl_func.c 24 Mar 2008 20:18:55 -0000 1.190
+++ lib/src/gretl_func.c 3 Apr 2008 15:00:59 -0000
@@ -3533,9 +3533,10 @@
err = anyerr;
}
} else {
- for (i=orig_v; i<pdinfo->v; i++) {
+ for (i=pdinfo->v; i>=orig_v; i--) {
+ fprintf(stderr, "i = %d (v = %d)\n", i, pdinfo->v);
if (STACK_LEVEL(pdinfo, i) == d) {
- anyerr = dataset_drop_variable(i--, pZ, pdinfo);
+ anyerr = dataset_drop_variable(i, pZ, pdinfo);
if (anyerr && !err) {
err = anyerr;
}
Sven, Ignacio, could you apply the patch and give some feedback?
Allin, could you check I haven't done anything wrong?
Riccardo (Jack) Lucchetti
Dipartimento di Economia
Università Politecnica delle Marche
r.lucchetti(a)univpm.it
http://www.econ.univpm.it/lucchetti