tr with d flag generates bad code if there is a replacement string. It only generates correct code if the replacement string is empty. For example: tr/ac/b/d; should map a->b and delete all 'c' characters.