Hi, consider this fairly minimal code example:

<hansl>

open denmark
loop i = $tmax..$tmax + 9
    catch value = LRM[i]  
    eval $error     # This line necessary to provoke the problem!
endloop

</hansl>

What I'm getting on gretl 2022c is that in the first loop iteration it works as expected, namely that catch isn't necessary (since LRM[$tmax] gives the last available obs) and the error value is zero.  Directly afterwards for i==$tmax+1 gretl says "index value 56 out of bounds". This is correct, but that's exactly what 'catch' should, well, catch.

Notice that when the $error value isn't accessed, then gretl does _not_ complain!

But that's not all - what follows is a more complex example without a direct $error access, where the simple loop construct works, but an equivalent while-loop does not work:

<hansl>

open denmark

loop i = $tmax..$tmax + 9
    catch value = LRM[i]    # works
endloop

print "got here?"

index = $tmax
loop while index < $tmax + 10
    catch value = LRM[index]  # fails
    index++
endloop

</hansl>

Could this have to do with the recent "more-compilation" internal gretl business, or did that not make it into gretl 2022c?

thanks

sven