Branch: Tag:

2015-09-09

2015-09-09 17:18:48 by Arne Goedeke <el@laramies.com>

block_allocator: fixed a bug in ba_sort_free_list

This could possibly happen after syntax errors when freeing
the compiler data.

425:   }      static size_t bv_ctz(struct bitvector * bv, size_t n) { -  size_t bit = n % BV_LENGTH; -  size_t c = n / BV_LENGTH; -  bv_int_t * _v = bv->v + c; -  bv_int_t V = *_v & (~BV_NIL << bit); +  size_t bit; +  size_t c; +  bv_int_t * _v; +  bv_int_t V;    -  +  if (n < bv->length) { +  bit = n % BV_LENGTH; +  c = n / BV_LENGTH; +  _v = bv->v + c; +  V = *_v & (~BV_NIL << bit); +     bit = c * BV_LENGTH;       while (1) { -  if (V) return bit + BV_CTZ(V); +  if (V) { +  bit += BV_CTZ(V); +  if (bit >= bv->length) break; +  return bit; +  }       bit += BV_LENGTH;   
441:       V = *(++_v);    } +  }       return (size_t)-1;   }