Loading ...
Sorry, an error occurred while loading the content.

Re: (bug) vim freezes and loops forever (uses 100% CPU) in syntax.c

Expand Messages
  • Bram Moolenaar
    ... I can reproduce it. Looks like a problem with the matchparen plugin when getting a syntax ID, combined with the syntax stack being wrong. This will be
    Message 1 of 2 , Dec 2, 2007
    • 0 Attachment
      Dominique Pelle wrote:

      > Hi
      >
      > I can reproduce a vim bug filed in Ubuntu launchpad using the latest
      > vim-7.1 (Patches 1-166). Here is a link to the original bug description:
      >
      > https://bugs.launchpad.net/ubuntu/+source/vim/+bug/68960
      >
      > Here is how I can reproduce it. I did not use '-u NONE', because
      > standard plugins need to be loaded to reproduce that bug.
      > ".vimrc" file only needs to contain "syntax on" to reproduce it:
      >
      > $ cat ~/.vimrc
      > syntax on
      >
      > $ vim +89 vim_testcase # file "vim_testcase" is attached
      >
      > ... then, when moving cursor around closing parentheses at
      > line 89, observe that vim freezes and takes 100% of CPU (it
      > can be interrupted with Ctrl-C).
      >
      > Trying to debug, 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 back 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'm using vim-7.1 (Patches 1-166) on Linux x86, built with
      > 'configure --with-features=huge'.

      I can reproduce it. Looks like a problem with the matchparen plugin
      when getting a syntax ID, combined with the syntax stack being wrong.

      This will be difficult to figure out, I'll put it in the todo list.

      --
      hundred-and-one symptoms of being an internet addict:
      172. You join listservers just for the extra e-mail.

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
      \\\ download, build and distribute -- http://www.A-A-P.org ///
      \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_dev" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    Your message has been successfully submitted and would be delivered to recipients shortly.