Hardeep Singh - 2008-02-01


The dc (desk calculator) command as bundled has a major bug. The version shows up as 1.2. 

On my GNU/Linux machine, the version installed is 1.3 and does not have this bug. The problem relates to looping beyond a certain count of iterations.

To replicate the bug, please use the following script:

[la 1 - psa lbx]sb lbx

if this is saved as temp.dc execute as below:

dc temp.dc

Its a simple down counter script.

I think it could be a memory issue, but shouldnt be because the dc internal stack is not increasing during the loop. The script runs for sometime, and simply dies after about 5 minutes. There is no error message either.

Is there a better way to do the loop?