smt_instrument_block(block *blk), which performs the per-block instrumentation, computes the similarity value as similarity = smt->ntotal / smt->ncandidates.
If smt->ncandidates is 0 (namely, there are no memory-write instruction in a basic block), this causes a division by zero.