unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: Another bug in CC Mode's state cache.
  2012-04-20 20:04 Another bug in CC Mode's state cache Alan Mackenzie
@ 2012-04-20  6:19 ` Leo
  2012-04-21  7:22   ` Alan Mackenzie
  2012-04-21  2:30 ` Stefan Monnier
  1 sibling, 1 reply; 5+ messages in thread
From: Leo @ 2012-04-20  6:19 UTC (permalink / raw)
  To: emacs-devel

On 2012-04-21 04:04 +0800, Alan Mackenzie wrote:
> The solution is to use the cache's memory of c rather than the paren in
> the buffer to bound the search.  This works.  I have tested it on 100,000
> random points in xdisp.c and 20,000 points in lisp.h.  The results with
> the new bugfix are identical to those without.

I'd love to see this fixed and this seems to indicate it is reasonably
safe.

Leo




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Another bug in CC Mode's state cache.
@ 2012-04-20 20:04 Alan Mackenzie
  2012-04-20  6:19 ` Leo
  2012-04-21  2:30 ` Stefan Monnier
  0 siblings, 2 replies; 5+ messages in thread
From: Alan Mackenzie @ 2012-04-20 20:04 UTC (permalink / raw)
  To: Chong Yidong; +Cc: emacs-devel

Hi, Yidong.

I've found and corrected another CC Mode state cache bug.  It occurred in
situations like this:

         {      }        (         {  }
	 a      b        c         e  f

Insert a closing paren after c:


         {      }        (    )     {  }
	 a      b        c    d     e  f

Previously, the backward search from e for a brace pair was bounded by
the paren at c.  After the insertion of d, the the paren pair c-d is
invisible to backward searching, hence the brace pair a-b is spuriously
found, leading to a cache corruption.

The solution is to use the cache's memory of c rather than the paren in
the buffer to bound the search.  This works.  I have tested it on 100,000
random points in xdisp.c and 20,000 points in lisp.h.  The results with
the new bugfix are identical to those without.

This clearly isn't a "regression".  Would it nevertheless be OK to
install this fix in the Emacs 24 branch?

-- 
Alan Mackenzie (Nuremberg, Germany).



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Another bug in CC Mode's state cache.
  2012-04-20 20:04 Another bug in CC Mode's state cache Alan Mackenzie
  2012-04-20  6:19 ` Leo
@ 2012-04-21  2:30 ` Stefan Monnier
  2012-04-21  7:19   ` Alan Mackenzie
  1 sibling, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2012-04-21  2:30 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: Chong Yidong, emacs-devel

> This clearly isn't a "regression".  Would it nevertheless be OK to
> install this fix in the Emacs 24 branch?

Since it's not a regression, I'd rather not put it on the
`emacs-24' branch.


        Stefan "who found your explanation scary"



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Another bug in CC Mode's state cache.
  2012-04-21  2:30 ` Stefan Monnier
@ 2012-04-21  7:19   ` Alan Mackenzie
  0 siblings, 0 replies; 5+ messages in thread
From: Alan Mackenzie @ 2012-04-21  7:19 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Chong Yidong, emacs-devel

Hi, Stefan,

On Fri, Apr 20, 2012 at 10:30:14PM -0400, Stefan Monnier wrote:
> > This clearly isn't a "regression".  Would it nevertheless be OK to
> > install this fix in the Emacs 24 branch?

> Since it's not a regression, I'd rather not put it on the
> `emacs-24' branch.

OK.  I'll put it into the trunk.

>         Stefan "who found your explanation scary"

Hmm.  The code for that cache _is_ somewhat scary.  I thought my
explanation was quite clear.

Funnily enough, the bug only shows itself very rarely.  I could only
reproduce it in the CC Mode branch I was working on.  A corrupt state
cache makes its presence felt very quickly.

-- 
Alan Mackenzie (Nuremberg, Germany).



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Another bug in CC Mode's state cache.
  2012-04-20  6:19 ` Leo
@ 2012-04-21  7:22   ` Alan Mackenzie
  0 siblings, 0 replies; 5+ messages in thread
From: Alan Mackenzie @ 2012-04-21  7:22 UTC (permalink / raw)
  To: Leo; +Cc: emacs-devel

Hi, Leo.

On Fri, Apr 20, 2012 at 02:19:37PM +0800, Leo wrote:
> On 2012-04-21 04:04 +0800, Alan Mackenzie wrote:
> > The solution is to use the cache's memory of c rather than the paren in
> > the buffer to bound the search.  This works.  I have tested it on 100,000
> > random points in xdisp.c and 20,000 points in lisp.h.  The results with
> > the new bugfix are identical to those without.

> I'd love to see this fixed and this seems to indicate it is reasonably
> safe.

I doubt you'd see much difference.  Like I said to Stefan, its symptoms
only appear very rarely.  But it'll go into the trunk.

> Leo

-- 
Alan Mackenzie (Nuremberg, Germany).



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-04-21  7:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-20 20:04 Another bug in CC Mode's state cache Alan Mackenzie
2012-04-20  6:19 ` Leo
2012-04-21  7:22   ` Alan Mackenzie
2012-04-21  2:30 ` Stefan Monnier
2012-04-21  7:19   ` Alan Mackenzie

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).