Subject: bug#21205: Error during redisplay: (jit-lock-function 3491)

From: Eli Zaretskii <[email-masked]>
Date: Fri, 07 Aug 2015 15:54:10 +0300

> From: 张海君 <[email-masked]>
> Date: Fri, 07 Aug 2015 18:43:54 +0800
> 
> Run emacs with "emacs -Q", and then eval the following code:
> ------------------------------------------------------------
> (setq font-lock-maximum-decoration 2
> 	  jit-lock-defer-time 0.05)
> (setq-default show-trailing-whitespace t)
> ------------------------------------------------------------
> 
> Then open the attached c file, and scroll down the buffer with key C-v C-v ... until the end of buffer.
> Switch to the message buffer *Message*. There are some error message as the following:
> ------------------------------------------------------------------------------
> Error during redisplay: (jit-lock-function 3102) signaled (error "Invalid search bound (wrong side of point)")

The errors are triggered by c-syntactic-re-search-forward.  Here's the
backtrace from the first such error, with the current master:

  #0  search_command (string=-9223372036754146592, bound=4611686018427389473,
      noerror=4274457416, count=0, direction=1, RE=1, posix=false)
      at search.c:1047
  #1  0x011cf1ed in Fre_search_forward (regexp=-9223372036754146592,
      bound=4611686018427389473, noerror=4274457416, count=0) at search.c:2245
  #2  0x0121c1a2 in Ffuncall (nargs=4, args=0x825428) at eval.c:2737
  #3  0x01276fd0 in exec_byte_code (bytestr=-9223372036753723160,
      vector=-6917529027611644184, maxdepth=4611686018427387913,
      args_template=0, nargs=0, args=0x0) at bytecode.c:919
  #4  0x0121d5ab in funcall_lambda (fun=-6917529027611643800, nargs=4,
      arg_vector=0x8259f0) at eval.c:2959
  #5  0x0121c633 in Ffuncall (nargs=5, args=0x8259e8) at eval.c:2775
  #6  0x01276fd0 in exec_byte_code (bytestr=-9223372036754145936,
      vector=-6917529027611456264, maxdepth=4611686018427387917,
      args_template=0, nargs=0, args=0x0) at bytecode.c:919
  #7  0x0121d5ab in funcall_lambda (fun=-6917529027612898016, nargs=3,
      arg_vector=0x825fd0) at eval.c:2959
  #8  0x0121c633 in Ffuncall (nargs=4, args=0x825fc8) at eval.c:2775
  #9  0x01276fd0 in exec_byte_code (bytestr=-9223372036753729256,
      vector=-6917529027611079432, maxdepth=4611686018427387909,
      args_template=0, nargs=0, args=0x0) at bytecode.c:919
  #10 0x0121d5ab in funcall_lambda (fun=-6917529027611079264, nargs=1,
      arg_vector=0x826570) at eval.c:2959
  #11 0x0121c633 in Ffuncall (nargs=2, args=0x826568) at eval.c:2775
  #12 0x01276fd0 in exec_byte_code (bytestr=-9223372036833489872,
      vector=-6917529027619795904, maxdepth=4611686018427387913,
      args_template=0, nargs=0, args=0x0) at bytecode.c:919
  #13 0x0121d5ab in funcall_lambda (fun=-6917529027619795968, nargs=3,
      arg_vector=0x826b30) at eval.c:2959
  #14 0x0121c633 in Ffuncall (nargs=4, args=0x826b28) at eval.c:2775
  #15 0x01276fd0 in exec_byte_code (bytestr=-9223372036833494416,
      vector=-6917529027619800448, maxdepth=4611686018427387909,
      args_template=0, nargs=0, args=0x0) at bytecode.c:919
  #16 0x0121d5ab in funcall_lambda (fun=-6917529027619800544, nargs=3,
      arg_vector=0x8270d0) at eval.c:2959
  #17 0x0121c633 in Ffuncall (nargs=4, args=0x8270c8) at eval.c:2775
  #18 0x01276fd0 in exec_byte_code (bytestr=-9223372036753541720,
      vector=-6917529027539731416, maxdepth=4611686018427387910,
      args_template=0, nargs=0, args=0x0) at bytecode.c:919
  #19 0x0121d5ab in funcall_lambda (fun=-6917529027539731280, nargs=3,
      arg_vector=0x827680) at eval.c:2959
  #20 0x0121c633 in Ffuncall (nargs=4, args=0x827678) at eval.c:2775
  #21 0x01276fd0 in exec_byte_code (bytestr=-9223372036833496152,
      vector=-6917529027619802184, maxdepth=4611686018427387908,
      args_template=0, nargs=0, args=0x0) at bytecode.c:919
  #22 0x0121d5ab in funcall_lambda (fun=-6917529027619802312, nargs=2,
      arg_vector=0x827c28) at eval.c:2959
  #23 0x0121c633 in Ffuncall (nargs=3, args=0x827c20) at eval.c:2775
  #24 0x01276fd0 in exec_byte_code (bytestr=-9223372036833477944,
      vector=-6917529027539145464, maxdepth=4611686018427387914,
      args_template=4611686018427388161, nargs=1, args=0x828410)
      at bytecode.c:919
  #25 0x0121cf63 in funcall_lambda (fun=-6917529027539145392, nargs=1,
      arg_vector=0x828408) at eval.c:2893
  #26 0x0121c633 in Ffuncall (nargs=2, args=0x828400) at eval.c:2775
  #27 0x0121b113 in run_hook_wrapped_funcall (nargs=2, args=0x828400)
      at eval.c:2452
  #28 0x0121b5aa in run_hook_with_args (nargs=2, args=0x828400,
      funcall=0x121b0cb <run_hook_wrapped_funcall>) at eval.c:2537
  #29 0x0121b162 in Frun_hook_wrapped (nargs=2, args=0x828400) at eval.c:2467
  #30 0x0121bf18 in Ffuncall (nargs=3, args=0x8283f8) at eval.c:2706
  #31 0x01276fd0 in exec_byte_code (bytestr=-9223372036833478056,
      vector=-6917529027619784088, maxdepth=4611686018427387923,
      args_template=4611686018427388418, nargs=2, args=0x828a20)
      at bytecode.c:919
  #32 0x0121cf63 in funcall_lambda (fun=-6917529027619784152, nargs=2,
      arg_vector=0x828a10) at eval.c:2893
  #33 0x0121c633 in Ffuncall (nargs=3, args=0x828a08) at eval.c:2775
  #34 0x01276fd0 in exec_byte_code (bytestr=-9223372036833477808,
      vector=-6917529027619783840, maxdepth=4611686018427387931,
      args_template=4611686018427388416, nargs=2, args=0x829048)
      at bytecode.c:919
  #35 0x0121cf63 in funcall_lambda (fun=-6917529027619783904, nargs=2,
      arg_vector=0x829038) at eval.c:2893
  #36 0x0121c633 in Ffuncall (nargs=3, args=0x829030) at eval.c:2775
  #37 0x01276fd0 in exec_byte_code (bytestr=-9223372036833478352,
      vector=-6917529027619784384, maxdepth=4611686018427387916,
      args_template=4611686018427388161, nargs=1, args=0x829660)
      at bytecode.c:919
  #38 0x0121cf63 in funcall_lambda (fun=-6917529027619784448, nargs=1,
      arg_vector=0x829658) at eval.c:2893
  #39 0x0121c633 in Ffuncall (nargs=2, args=0x829650) at eval.c:2775
  #40 0x01217416 in internal_condition_case_n (bfun=0x121bbde <Ffuncall>,
      nargs=2, args=0x829650, handlers=53088,
      hfun=0x1039405 <safe_eval_handler>) at eval.c:1438
  #41 0x0103965b in safe__call (inhibit_quit=false, nargs=2, func=4280165648,
      ap=0x829714 "") at xdisp.c:2508
  #42 0x010396f6 in safe_call (nargs=2, func=4280165648) at xdisp.c:2524
  #43 0x0103974a in safe_call1 (fn=4280165648, arg=4611686018427388947)
      at xdisp.c:2535
  #44 0x0103d8e5 in handle_fontified_prop (it=0x82a6d0) at xdisp.c:3749
  #45 0x0103c46d in handle_stop (it=0x82a6d0) at xdisp.c:3313
  #46 0x0104c2d3 in next_element_from_buffer (it=0x82a6d0) at xdisp.c:8153
  #47 0x01048afe in get_next_display_element (it=0x82a6d0) at xdisp.c:6805
  #48 0x0107b1c0 in display_line (it=0x82a6d0) at xdisp.c:20227
  #49 0x0106d191 in try_window (window=-6917529027612397280, pos=..., flags=1)
      at xdisp.c:16900
  #50 0x010691b7 in redisplay_window (window=-6917529027612397280,
      just_this_one_p=true) at xdisp.c:16373
  #51 0x01060000 in redisplay_window_1 (window=-6917529027612397280)
      at xdisp.c:14198
  #52 0x01217136 in internal_condition_case_1 (
      bfun=0x105ffa5 <redisplay_window_1>, arg=-6917529027612397280,
      handlers=-4611686018403211200, hfun=0x105fef5 <redisplay_window_error>)
      at eval.c:1380
  #53 0x0105ef9f in redisplay_internal () at xdisp.c:13841
  #54 0x0105f6f8 in redisplay_preserve_echo_area (from_where=2) at xdisp.c:14027
  #55 0x01011009 in Fredisplay (force=0) at dispnew.c:5785
  #56 0x0121c06d in Ffuncall (nargs=1, args=0x82dcb0) at eval.c:2726
  #57 0x01276fd0 in exec_byte_code (bytestr=-9223372036834414648,
      vector=-6917529027620720680, maxdepth=4611686018427387911,
      args_template=4611686018427388673, nargs=1, args=0x82e258)
      at bytecode.c:919
  #58 0x0121cf63 in funcall_lambda (fun=-6917529027620720744, nargs=1,
      arg_vector=0x82e250) at eval.c:2893
  #59 0x0121c633 in Ffuncall (nargs=2, args=0x82e248) at eval.c:2775
  #60 0x01276fd0 in exec_byte_code (bytestr=-9223372036833476664,
      vector=-6917529027619782696, maxdepth=4611686018427387916,
      args_template=4611686018427387904, nargs=0, args=0x82e9c8)
      at bytecode.c:919
  #61 0x0121cf63 in funcall_lambda (fun=-6917529027619782760, nargs=0,
      arg_vector=0x82e9c8) at eval.c:2893
  #62 0x0121c633 in Ffuncall (nargs=1, args=0x82e9c0) at eval.c:2775
  #63 0x0121a9f7 in Fapply (nargs=2, args=0x82e9c0) at eval.c:2297
  #64 0x0121bf18 in Ffuncall (nargs=3, args=0x82e9b8) at eval.c:2706
  #65 0x01276fd0 in exec_byte_code (bytestr=-9223372036833436560,
      vector=-6917529027619742592, maxdepth=4611686018427387911,
      args_template=0, nargs=0, args=0x0) at bytecode.c:919
  #66 0x0121d5ab in funcall_lambda (fun=-6917529027619742656, nargs=1,
      arg_vector=0x82ef68) at eval.c:2959
  #67 0x0121c633 in Ffuncall (nargs=2, args=0x82ef60) at eval.c:2775
  #68 0x0121b7cc in call1 (fn=54544, arg1=-6917529027539397488) at eval.c:2581
  #69 0x0115bc67 in timer_check_2 (timers=0, idle_timers=-4611686018325442896)
      at keyboard.c:4530
  #70 0x0115bde2 in timer_check () at keyboard.c:4597
  #71 0x0115900e in readable_events (flags=1) at keyboard.c:3432
  #72 0x01162caa in get_input_pending (flags=1) at keyboard.c:6815
  #73 0x0116cf95 in detect_input_pending_run_timers (do_display=true)
      at keyboard.c:9978
  #74 0x01287d94 in wait_reading_process_output (time_limit=30, nsecs=0,
      read_kbd=-1, do_display=true, wait_for_cell=0, wait_proc=0x0,
      just_wait_proc=0) at process.c:5013
  #75 0x01010ee8 in sit_for (timeout=4611686018427387934, reading=true,
      display_option=1) at dispnew.c:5756
  #76 0x01156016 in read_char (commandflag=1, map=-4611686018325436640,
      prev_event=0, used_mouse_menu=0x82f623, end_time=0x0) at keyboard.c:2779
  #77 0x0116a700 in read_key_sequence (keybuf=0x82f7c8, bufsize=30, prompt=0,
      dont_downcase_last=false, can_return_switch_frame=true,
      fix_current_buffer=true, prevent_redisplay=false) at keyboard.c:9161
  #78 0x011516a0 in command_loop_1 () at keyboard.c:1402
  #79 0x01216fd4 in internal_condition_case (bfun=0x11510b8 <command_loop_1>,
      handlers=20720, hfun=0x115039b <cmd_error>) at eval.c:1356
  #80 0x01150b5a in command_loop_2 (ignore=0) at keyboard.c:1134
  #81 0x01216031 in internal_catch (tag=55216, func=0x1150b1e <command_loop_2>,
      arg=0) at eval.c:1116
  #82 0x01150ad8 in command_loop () at keyboard.c:1113
  #83 0x0114fdb7 in recursive_edit_1 () at keyboard.c:723
  #84 0x01150074 in Frecursive_edit () at keyboard.c:794
  #85 0x0114d7fe in main (argc=2, argv=0xa427e0) at emacs.c:1629

  Lisp Backtrace:
  "re-search-forward" (0x825430)
  "c-syntactic-re-search-forward" (0x8259f0)
  "c-font-lock-declarators" (0x825fd0)
  0x1c9cda0 PVEC_COMPILED
  "font-lock-fontify-keywords-region" (0x826b30)
  "font-lock-default-fontify-region" (0x8270d0)
  "c-font-lock-fontify-region" (0x827680)
  "font-lock-fontify-region" (0x827c28)
  0x6136d50 PVEC_COMPILED
  "run-hook-wrapped" (0x828400)
  "jit-lock--run-functions" (0x828a10)
  "jit-lock-fontify-now" (0x829038)
  "jit-lock-function" (0x829658)
  "redisplay_internal (C function)" (0x0)
  "redisplay" (0x82dcb8)
  "sit-for" (0x82e250)
  "jit-lock-deferred-fontify" (0x82e9c8)
  "apply" (0x82e9c0)
  "timer-event-handler" (0x82ef68)
  (gdb) p n
  $1 = 1
  (gdb) p lim
  $2 = 1569
  (gdb) p PT
  $3 = 1611
  (gdb) up
  #1  0x011cf1ed in Fre_search_forward (regexp=-9223372036754146592,
      bound=4611686018427389473, noerror=4274457416, count=0) at search.c:2245
  2245      return search_command (regexp, bound, noerror, count, 1, 1, 0);
  (gdb) p regexp
  $4 = -9223372036754146592
  (gdb) xtype
  Lisp_String
  (gdb) xstring
  $5 = (struct Lisp_String *) 0x5ff7ae0
  "[;,{]"
  (gdb) p bound
  $6 = 4611686018427389473
  (gdb) xtype
  Lisp_Int0
  (gdb) xint
  $7 = 1569
  (gdb) p noerror
  $8 = 4274457416
  (gdb) xtype
  Lisp_Symbol
  (gdb) xsymbol
  $9 = (struct Lisp_Symbol *) 0x1785a30 <dumped_data+514096>
  "move"