Subject: bug#18438: 24.4.50; assertion failed in bidi.c

From: Eli Zaretskii <[email-masked]>
Date: Wed, 24 Sep 2014 18:01:14 +0300

> Date: Wed, 24 Sep 2014 10:06:30 -0400
> From: Ken Brown <[email-masked]>
> CC: Eli Zaretskii <[email-masked]>
> 
> By the way, I just got the same assertion failure in bidi.c, with a 
> backtrace under gdb 7.8 (attached).

What is the backtrace of the other threads?

> The assertion failure still doesn't make sense because
> type=STRONG_L.  But I see lots of strange values of "type" in frames
> 3 and higher.

Which ones?  The only ones I see are these:

  #3  0x00000001005009cc in bidi_level_of_next_char (bidi_it=0x426878)
      at /usr/src/debug/emacs-24.3.93-4/src/bidi.c:2325
	  eob = 811
	  type = UNKNOWN_BT
	  level = 0
	  prev_level = -1
	  next_for_neutral = {
	    bytepos = 4353152, 
	    charpos = 4300194024, 
	    type = 4344736,         <<<<<<<<<<<<<<<<<<<<<<<<<<<
	    type_after_w1 = UNKNOWN_BT, 
	    orig_type = 2148292989  <<<<<<<<<<<<<<<<<<<<<<<<<<<
	  }

which is OK, since the next_for_neutral member doesn't have to be
initialized (the UNKNOWN_BT value in type_after_w1 says it isn't), and
will not be used until it is.  Others are in frame #6, like this:

          bidi_it = {
            bytepos = 4348392, 
            charpos = 4306733202, 
            ch = 5482662, 
            nchars = 25775286310, 
            ch_len = 25775286790, 
            type = 4348416, 
            type_after_w1 = UNKNOWN_BT, 
            orig_type = 6632775, 

but it is from the wrap_it variable, which is not assigned values
unless you have word-wrap turned on in that buffer.

I also see a 'struct it' in redisplay_window (frame #8) with garbled
bidi type values, but that variable is only used under certain
conditions (see line 16178 of xdisp.c), and I have no reason to
believe those conditions were true in this case.

So I don't really see any immediate problems here.

We are left with the riddle.