Comment 6 for bug 68960

Revision history for this message
Dominique Pellé (dominique-pelle) wrote :

I did a bit of debugging with latest vim-7.1 (patches 1-166).

I found that vim loops forever in a while(...)
loop in syntax.c in function syntax_start():

syntax.c:

 562 while (current_lnum < lnum)
 563 {
 ...
 ...
 596 load_current_state(prev);
 ...
 ...
 609 line_breakcheck();
 610 if (got_int)
 611 {
 612 current_lnum = lnum;
 613 break;
 614 }
 615 }

This while loop never ends with attached "vim_testcase" file.
Adding some printf(), I can see that:

  - Before entering above while loop:
      - current_lnum == 65
      - lnum == 80

  - Then when iterating in the while loop:
      - lnum remains unchanged (80)
      - current_lnum becomes:

        65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
        65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
        65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
        etc.

current_lnum never reaches lnum (80) so loop never ends.

current_lnum goes from 78 to 65 when calling load_current_state(prev)
at line 596.

I do not understand the idea behind load_current_state() and
store_current_state() to go beyond and come up with fix for this.

I posted this to the vim_dev mailing list:

http://groups.google.com/group/vim_dev/browse_thread/thread/157f265102c48127/5550df9950274543?lnk=st&q=#5550df9950274543