Subject: Re: bug#23271: CC Mode 5.33 (C/l); Cache failure

From: Michael Welsh Duggan <[email-masked]>
Date: Thu, 05 May 2016 15:49:58 -0400

Alan Mackenzie <[email-masked]> writes:

> Hello, Michael.
>
> On Tue, Apr 26, 2016 at 04:18:50PM -0400, Michael Welsh Duggan wrote:
>> Alan Mackenzie <[email-masked]> writes:
>
>> > Sorry about the delayed response.
>
>> > I think I've tracked down what is causing this cache failure, but I'm
>> > not yet totally convinced by my patch for it.
>
> Now, I don't think I was right.
>
>> > It seems to be an error in adjusting the cache when the buffer gets
>> > narrowed.  In particular, when the new point-min is inside a brace pair
>> > which was previously recorded in the cache.
>
>> > Give me a little time, and I'll get back to you with a patch.
>
>> Sure.  I (obviously) normally run with cache debugging turned on, and I
>> get cache errors fairly frequently.  Unfortunately, I can really only
>> send you the ones I can reproduce.  Each time I hope that the bug fixed
>> includes all of the errors I see.  :)
>
> I think the issue here is `open-paren-in-column-0-is-defun-start'.  In
>
>>> c-parse-state inconsistency at 33929: using cache: (33928 33838
>>> (32429 . 33731) 795 365), from scratch: (33928 33838 (32429
>>> . 33731))
>
> , the brace pair (32429 . 33731)'s opener at 32429 is in column zero.
> So, if `open-paren-...-start' is non-nil, the low level syntax routines
> aren't going to be scanning back any further than that.  I think, in
> this case, the braces at 365 and 795 got into the cache early on, and
> stayed there.
>
> Would you check your setting of that variable, please, and if it's
> non-nil, try setting it to nil to see if the inconsistency goes away.
> If it's already nil, please let me know, in which case I've got some
> serious head scratching to do.

This occurs with a nil setting of
`open-paren-in-column-0-is-defun-start'.  It was nil when I submitted
the original bug report.  (You might want to add this variable to the
c-submit-bug-report report.)

Apologies in advance for any hair loss.  :)

I tried it on a different machine with the same frame width (but
different frame height), and got the included output after 8 page-downs.
The last full line on the first page is:

   *    <li>the graph is bidirectional ("bidrectionalS" as the third template argument),</li>

I hope this differing output helps you track down the problem.

c-debug-parse-state enabled
c-parse-state inconsistency at 25771: using cache: (25731 (25567 . 25569) 25148), from scratch: (25731 (25567 . 25569) 25148 (24724 . 24726))
Old state:
(setq c-state-cache '(25772 25731 (25567 . 25569) 25148 (24419 . 24884) 7660 795 365)  c-state-cache-good-pos 25773  c-state-nonlit-pos-cache '(53334 50334 47334 44334 41334 38334 35334 32334 29099 26099 23099 20099 17099 13993 10731 7641)  c-state-nonlit-pos-cache-limit 53334  c-state-semi-nonlit-pos-cache '(23099 20099 17099 13993 10731 7641)  c-state-semi-nonlit-pos-cache-limit 23099  c-state-brace-pair-desert nil  c-state-point-min 1  c-state-point-min-lit-type nil  c-state-point-min-lit-start nil  c-state-min-scan-pos 1  c-state-old-cpp-beg nil  c-state-old-cpp-end nil  c-parse-state-point 25898)
c-parse-state inconsistency at 25730: using cache: ((25567 . 25569) 25148), from scratch: ((25567 . 25569) 25148 (24724 . 24726))
Old state:
(setq c-state-cache '(25772 25731 (25567 . 25569) 25148 (24419 . 24884) 7660 795 365)  c-state-cache-good-pos 25773  c-state-nonlit-pos-cache '(53334 50334 47334 44334 41334 38334 35334 32334 29099 26099 23099 20099 17099 13993 10731 7641)  c-state-nonlit-pos-cache-limit 53334  c-state-semi-nonlit-pos-cache '(23099 20099 17099 13993 10731 7641)  c-state-semi-nonlit-pos-cache-limit 23099  c-state-brace-pair-desert nil  c-state-point-min 1  c-state-point-min-lit-type nil  c-state-point-min-lit-start nil  c-state-min-scan-pos 1  c-state-old-cpp-beg nil  c-state-old-cpp-end nil  c-parse-state-point 25898)
c-parse-state inconsistency at 25695: using cache: ((25567 . 25569) 25148), from scratch: ((25567 . 25569) 25148 (24724 . 24726))
Old state:
(setq c-state-cache '(25772 25731 (25567 . 25569) 25148 (24419 . 24884) 7660 795 365)  c-state-cache-good-pos 25773  c-state-nonlit-pos-cache '(53334 50334 47334 44334 41334 38334 35334 32334 29099 26099 23099 20099 17099 13993 10731 7641)  c-state-nonlit-pos-cache-limit 53334  c-state-semi-nonlit-pos-cache '(23099 20099 17099 13993 10731 7641)  c-state-semi-nonlit-pos-cache-limit 23099  c-state-brace-pair-desert nil  c-state-point-min 1  c-state-point-min-lit-type nil  c-state-point-min-lit-start nil  c-state-min-scan-pos 1  c-state-old-cpp-beg nil  c-state-old-cpp-end nil  c-parse-state-point 25898)
c-parse-state inconsistency at 25569: using cache: ((25567 . 25569) 25148), from scratch: ((25567 . 25569) 25148 (24724 . 24726))
Old state:
(setq c-state-cache '(25772 25731 (25567 . 25569) 25148 (24419 . 24884) 7660 795 365)  c-state-cache-good-pos 25773  c-state-nonlit-pos-cache '(53334 50334 47334 44334 41334 38334 35334 32334 29099 26099 23099 20099 17099 13993 10731 7641)  c-state-nonlit-pos-cache-limit 53334  c-state-semi-nonlit-pos-cache '(23099 20099 17099 13993 10731 7641)  c-state-semi-nonlit-pos-cache-limit 23099  c-state-brace-pair-desert nil  c-state-point-min 1  c-state-point-min-lit-type nil  c-state-point-min-lit-start nil  c-state-min-scan-pos 1  c-state-old-cpp-beg nil  c-state-old-cpp-end nil  c-parse-state-point 25898)
c-parse-state inconsistency at 25730: using cache: ((25567 . 25569) 25148), from scratch: ((25567 . 25569) 25148 (24724 . 24726))
Old state:
(setq c-state-cache '(25772 25731 (25567 . 25569) 25148 (24419 . 24884) 7660 795 365)  c-state-cache-good-pos 25773  c-state-nonlit-pos-cache '(53334 50334 47334 44334 41334 38334 35334 32334 29099 26099 23099 20099 17099 13993 10731 7641)  c-state-nonlit-pos-cache-limit 53334  c-state-semi-nonlit-pos-cache '(23099 20099 17099 13993 10731 7641)  c-state-semi-nonlit-pos-cache-limit 23099  c-state-brace-pair-desert nil  c-state-point-min 1  c-state-point-min-lit-type nil  c-state-point-min-lit-start nil  c-state-min-scan-pos 1  c-state-old-cpp-beg nil  c-state-old-cpp-end nil  c-parse-state-point 25898)
c-parse-state inconsistency at 25695: using cache: ((25567 . 25569) 25148), from scratch: ((25567 . 25569) 25148 (24724 . 24726))
Old state:
(setq c-state-cache '(25772 25731 (25567 . 25569) 25148 (24419 . 24884) 7660 795 365)  c-state-cache-good-pos 25773  c-state-nonlit-pos-cache '(53334 50334 47334 44334 41334 38334 35334 32334 29099 26099 23099 20099 17099 13993 10731 7641)  c-state-nonlit-pos-cache-limit 53334  c-state-semi-nonlit-pos-cache '(23099 20099 17099 13993 10731 7641)  c-state-semi-nonlit-pos-cache-limit 23099  c-state-brace-pair-desert nil  c-state-point-min 1  c-state-point-min-lit-type nil  c-state-point-min-lit-start nil  c-state-min-scan-pos 1  c-state-old-cpp-beg nil  c-state-old-cpp-end nil  c-parse-state-point 25898)
c-parse-state inconsistency at 25569: using cache: ((25567 . 25569) 25148), from scratch: ((25567 . 25569) 25148 (24724 . 24726))
Old state:
(setq c-state-cache '(25772 25731 (25567 . 25569) 25148 (24419 . 24884) 7660 795 365)  c-state-cache-good-pos 25773  c-state-nonlit-pos-cache '(53334 50334 47334 44334 41334 38334 35334 32334 29099 26099 23099 20099 17099 13993 10731 7641)  c-state-nonlit-pos-cache-limit 53334  c-state-semi-nonlit-pos-cache '(23099 20099 17099 13993 10731 7641)  c-state-semi-nonlit-pos-cache-limit 23099  c-state-brace-pair-desert nil  c-state-point-min 1  c-state-point-min-lit-type nil  c-state-point-min-lit-start nil  c-state-min-scan-pos 1  c-state-old-cpp-beg nil  c-state-old-cpp-end nil  c-parse-state-point 25898)

-- 
Michael Welsh Duggan
([email-masked])