As it turns out, it was a somewhat subtle bug in the code. The compiler is fine.

Change the following code:
    
    
    proc segsieve(Kn: int) =             # for Kn resgroups in segment
      for b in 0 .. <Kn*bprg: seg[b] = 0 # initialize seg bits to all prime '0'
    

to:
    
    
    proc segsieve(Kn: int) =             # for Kn resgroups in segment
      for b in 0 .. <(Kn*bprg): seg[b] = 0 # initialize seg bits to all prime 
'0'
    

Note the parentheses around `Kn*bprg`. Alternatively, just use `Kn*bprg-1`.

Operator precedence here _is_ surprising and we may want to think how to avoid 
that this trips up other people, but the code seems to work fine with this 
change.

Reply via email to