[Gretl-devel] bug which is new in 1.7.4

Allin Cottrell cottrell at wfu.edu
Thu Apr 3 11:32:37 EDT 2008


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.

Sorry, I'm getting started late today.  I'll have a proper look 
shortly, but in principle the "i--" is right: when we delete a 
variable, all the higher-numbered variables get renumbered.  If 
you just checked and deleted variable 10, say, then you need to 
check variable 10 next, since it will be what used to be variable 
11.

Allin.




More information about the Gretl-devel mailing list