[V] Fix search assertion failure

Stephen J. Turnbull stephen at xemacs.org
Sat Feb 9 21:41:59 EST 2008


VETO

Michael Sperber writes:
 > 
 > Aidan, could you look at this?
 > 
 > search.c, about line 1441:
 > 
 >                   do
 >                     {
 >                       translated = TRANSLATE (inverse_trt, translated);
 > 
 >                       if (charset_base == (translated & ~ICHAR_FIELD3_MASK))
 >                         break;
 > 
 >                     } while (starting_ch != translated);
 > 
 >                   assert (starting_ch != translated);
 > 
 > It seems to me (not really understanding the details of all this
 > translation and inverse translation business) that the assertion is
 > bogus: It mirrors the loop condition, yet there's a break statement in
 > the loop right before.  (And that's exactly what's getting triggered for
 > me.)  So I suggest just zapping it.  At least what used to crash my
 > XEmacs now works.

The pseudo-code is something like this

if this translation is inappropriate for Boyer-Moore then
  do
    get next candidate translation
    if it is appropriate
      break
  while we haven't run out of candidates
assert we found a usable translation

So maybe the code works for you, but it's not working according to
theory.

At the least, I think the assert should be replaced with

    if (starting_ch != translated) { boyer_moore_ok = 0; break; }

I believe that's safe.  Aidan?



More information about the XEmacs-Patches mailing list