GNU bug report logs - #5786
new cc-mode <>-matching barfs in complex case

Previous Next

Packages: cc-mode, emacs;

Reported by: Daniel Colascione <daniel <at> censorshipresearch.org>

Date: Fri, 26 Mar 2010 23:55:01 UTC

Severity: normal

Tags: moreinfo, unreproducible

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 5786 in the body.
You can then email your comments to 5786 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5786; Package emacs. (Fri, 26 Mar 2010 23:55:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Daniel Colascione <daniel <at> censorshipresearch.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 26 Mar 2010 23:55:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Daniel Colascione <daniel <at> censorshipresearch.org>
To: bug-gnu-emacs <at> gnu.org
Subject: new cc-mode <>-matching barfs in complex case
Date: Fri, 26 Mar 2010 19:54:41 -0400
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Note: Although the trace below is from Emacs 22, I'm using cc-mode from
HEAD. It doesn't affect the bug.

cc-mode seems to barf in certain cases on files with lots of template
brackets. I can't quite figure out what's wrong with it: the testcase
below is about as small as I could make it.

To reproduce: load the following file in c++-mode, position point at
line 3, column 6 (just after the "/*"), and press space. It's
important not to scroll around the buffer first. You'll see a
backtrace something like this:

  signal(error ("Invalid search bound (wrong side of point)"))
  (condition-case err (while (and ... ... ...)) (error (goto-char start)
(signal ... ...)))
  (let ((start ...) tmp search-pos state (state-pos ...) check-pos
check-state (last-token-end-pos ...) found) (condition-case err (while
...) (error ... ...)) (if found (progn ... ...) (if ... ... ...) nil))
  c-syntactic-re-search-forward("[;{}]" 2109 end)
  (let ((beg-lit-limits ...) (end-lit-limits ...)) (goto-char (if
beg-lit-limits ... beg)) (c-syntactic-skip-backward "^;{}" (max ...
...)) (while (c-search-forward-char-property ... ... beg)
(c-clear-<-pair-props-if-match-after beg ...)) (goto-char (if
end-lit-limits ... end)) (c-syntactic-re-search-forward "[;{}]" (min ...
...) (quote end)) (while (c-search-backward-char-property ... ... end)
(c-clear->-pair-props-if-match-before end)))
  (save-excursion (let (... ...) (goto-char ...)
(c-syntactic-skip-backward "^;{}" ...) (while ... ...) (goto-char ...)
(c-syntactic-re-search-forward "[;{}]" ... ...) (while ... ...)))
  c-before-change-check-<>-operators(61 61)
  funcall(c-before-change-check-<>-operators 61 61)
  (lambda (fn) (funcall fn beg end))(c-before-change-check-<>-operators)
  mapc((lambda (fn) (funcall fn beg end)) (c-extend-region-for-CPP
c-before-change-check-<>-operators))
  (if c-get-state-before-change-functions (mapc (lambda ... ...)
c-get-state-before-change-functions))
  (save-excursion (c-unfind-enclosing-token beg)
(c-unfind-enclosing-token end) (when (< beg end)
(c-unfind-coalesced-tokens beg end)) (let (lim type type-pos marked-id
term-pos ...) (when ... ... ... ...)) (setq c-new-BEG beg c-new-END end)
(if c-get-state-before-change-functions (mapc ...
c-get-state-before-change-functions)))
  (progn (widen) (save-excursion (c-unfind-enclosing-token beg)
(c-unfind-enclosing-token end) (when ... ...) (let ... ...) (setq
c-new-BEG beg c-new-END end) (if c-get-state-before-change-functions ...)))
  (unwind-protect (progn (widen) (save-excursion ... ... ... ... ...
...)) (set-match-data save-match-data-internal (quote evaporate)))
  (let ((save-match-data-internal ...)) (unwind-protect (progn ... ...)
(set-match-data save-match-data-internal ...)))
  (save-match-data (widen) (save-excursion (c-unfind-enclosing-token
beg) (c-unfind-enclosing-token end) (when ... ...) (let ... ...) (setq
c-new-BEG beg c-new-END end) (if c-get-state-before-change-functions ...)))
  (save-restriction (save-match-data (widen) (save-excursion ... ... ...
... ... ...)))
  c-before-change(61 61)



== BEGIN TESTCASE ==
void foo_impl::gc_mark(gc::mark_context mc) throw()
{
    /*
    if(mc.abandon) {
        this->shutdown();
    }

    gc_process(mc, &this->ack_fiber);
    gc_process(mc, &this->err);

    source::gc_mark(mc);
    sink::gc_mark(mc);
}

foo_id foo::get_id() const throw()
{
    if(this->impl()->chan) {
        return this->impl()->self_it->first;
    }

    return 0;
}

ptr<spam> foo::get_spam() const throw()
{
    return this->impl()->chan;
};



void foo_impl::on_ack_bytes(size_t howmany)
{
    // check for overflow
    if(this->remote_bufsz + howmany < this->remote_bufsz) {
        throw (peer_on_fire()
               << protocol_error_reason("impossible remote buffer size"));
    }

    this->remote_bufsz += howmany;
    this->remote_has_room.wake();
}

void foo_impl::tentative_add_bytes(size_t howmany, ptr<io::source> src)
{
    if(this->incoming.avail() < howmany) {
        throw peer_on_fire()
            << protocol_error_reason("peer overflowed buffer");
    }

    read_all(src, this->incoming.get_append_ptr(), howmany);
    this->incoming.note_written(howmany);
}

size_t foo_impl::confirm_add_bytes(size_t howmany) throw()
{
    assert(this->real_available <= this->incoming.size());
    assert(howmany <= this->incoming.size() - this->real_available);

    this->real_available += howmany;
    this->real_available_nonzero.wake();
    return this->incoming.size() - this->real_available;
}

void foo_impl::remove_new_bytes(size_t howmany) throw()
{
    assert(this->real_available <= this->incoming.size());
    assert(howmany <= this->incoming.size() - this->real_available);

    this->incoming.erase(this->incoming.end() - howmany,
                         this->incoming.end());
}

void foo_impl::shutdown()
{
    this->eof_from_peer = true;
    this->eof_to_peer   = true;
    this->stop_everything();
}

void foo_impl::shutdown_with_error(const ptr<error::base>& err)
{
    this->err = err;
    this->stop_everything();
}

void foo_impl::stop_everything() throw()
{
    this->ack_fiber->cancel();
    this->chan.reset();

    /* Readers and writers may be waiting on these */
    this->remote_has_room.wake();
}

== END TESTCASE ==




In GNU Emacs 22.3.1 (i386-apple-darwin9.6.0, Carbon Version 1.6.0)
 of 2009-01-03 on seijiz.local
Windowing system distributor `Apple Inc.', version 10.6.2
configured using `configure
'--prefix=/Applications/Emacs.app/Contents/Resources' '--with-carbon'
'--without-x'
'--libexecdir=/Volumes/Emacs/Emacs.app/Contents/MacOS/libexec'
'CFLAGS=-Os -arch i386 -arch ppc7400 -DUSE_ATSUI -DUSE_MAC_TSM''

Important settings:
  value of $LC_ALL: en_US.UTF-8
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8
  default-enable-multibyte-characters: t

Major mode: C++/l

Minor modes in effect:
  linum-mode: t
  yas/minor-mode: t
  cua-mode: t
  which-function-mode: t
  global-hi-lock-mode: t
  hi-lock-mode: t
  show-paren-mode: t
  savehist-mode: t
  mac-print-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  abbrev-mode: t

Recent input:
o n v <return> f o o <return> ! M-< <down> <down> C-e
M-x c + + - m o d e <return> <up> <down> <backspace>
q <left> C-x C-s M-< M-% C-g M-% C-g <next> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <wheel-up> <double-wheel-up> <triple-wheel-up>
<triple-wheel-up> <triple-wheel-up> <down-mouse-1>
<mouse-1> <down> C-e <backspace> C-x C-s M-x c + +
- - m o d e <return> <up> <down> SPC q <wheel-down> <double-wheel-down>
<wheel-down> <wheel-down> <wheel-down> <down-mouse-1>
<mouse-1> <wheel-down> <down-mouse-1> <mouse-1> <up>
C-a <S-down> <S-down> <S-down> <S-down> <S-down> <S-down>
<S-down> <delete> M-< <down> <down> C-e M-x c + + -
m o d e <return> SPC C-z M-x c + + - m o d e <return>
SPC C-z C-z C-z C-z C-x C-s <down-mouse-1> <mouse-movement>
<drag-mouse-1> <wheel-up> <double-wheel-up> <triple-wheel-up>
<triple-wheel-up> <down-mouse-1> <mouse-1> <wheel-up>
<double-wheel-up> <triple-wheel-up> <down-mouse-1>
<mouse-1> <wheel-down> <double-wheel-down> <triple-wheel-down>
<triple-wheel-down> <triple-wheel-down> <triple-wheel-down>
<triple-wheel-up> <triple-wheel-up> <wheel-up> <double-wheel-up>
<up> <down-mouse-1> <mouse-1> <wheel-up> <double-wheel-up>
<up> <up> <down> <down> <down> C-a C-k C-k <up> <up>
<up> <up> <up> <up> <up> <up> C-e M-x c + + - m o d
e <return> SPC C-z <up> C-z C-z C-z C-z C-x C-s M-<
M-x c + + - m o d e <return> <down> <down> C-e SPC
q <wheel-down> <double-wheel-down> <triple-wheel-down>
<wheel-down> <double-wheel-down> <wheel-up> <double-wheel-up>
<triple-wheel-up> <triple-wheel-up> <triple-wheel-up>
<triple-wheel-up> <down> <up> <wheel-down> <double-wheel-down>
<triple-wheel-down> <triple-wheel-down> M-< C-g C-g
C-g C-x C-s M-< M-% c h a n n e l <return> s p a m
m <backspace> <return> ! M-< <down> <down> C-e M-x
c + + - m o d e <return> SPC q C-x C-s C-x k C-x C-f
a <backspace> f o o . c p p <return> <down> <down>
C-e SPC q <left> <right> <right> <left> M-x r e p o
r t - e m <tab> <return>

Recent messages:
(No changes need to be saved)
Mark set [2 times]
Replaced 2 occurrences
Mark set
Entering debugger...
Back to top level.
Wrote /tmp/foo.cpp
Entering debugger...
Back to top level.
Loading emacsbug...done
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (Darwin)

iEYEARECAAYFAkutSUEACgkQ17c2LVA10VstGwCfRpTHoPriKbfSCS/HZ8v2uwsc
ZmsAoLA3yEJXbY2JebH1MFngoVW0MNyO
=FYVW
-----END PGP SIGNATURE-----





bug reassigned from package 'emacs' to 'emacs,cc-mode'. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 30 Mar 2010 17:42:02 GMT) Full text and rfc822 format available.

Severity set to 'serious' from 'normal' Request was from Chong Yidong <cyd <at> stupidchicken.com> to control <at> debbugs.gnu.org. (Sat, 03 Apr 2010 00:14:01 GMT) Full text and rfc822 format available.

Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org:
bug#5786; Package emacs,cc-mode. (Sat, 03 Apr 2010 23:00:03 GMT) Full text and rfc822 format available.

Message #12 received at 5786 <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Daniel Colascione <daniel <at> censorshipresearch.org>
Cc: 5786 <at> debbugs.gnu.org, Alan Mackenzie <acm <at> muc.de>
Subject: Re: new cc-mode <>-matching barfs in complex case
Date: Sat, 03 Apr 2010 18:59:22 -0400
> Note: Although the trace below is from Emacs 22, I'm using cc-mode from
> HEAD. It doesn't affect the bug.
>
> cc-mode seems to barf in certain cases on files with lots of template
> brackets. I can't quite figure out what's wrong with it: the testcase
> below is about as small as I could make it.
>
> To reproduce: load the following file in c++-mode, position point at
> line 3, column 6 (just after the "/*"), and press space. It's
> important not to scroll around the buffer first. You'll see a
> backtrace

I can't reproduce the bug using emacs-23 branch (nor with the 23.1.95
pretest), starting from `emacs -Q'.

Daniel, could you please check if a 23.1.95 build from
ftp://alpha.gnu.org/gnu/emacs/pretest/ has this problem?

If so, please provide an even more exact recipe, sending the test file
as an attachement and providing precise steps starting from `emacs -Q'.




Severity set to 'important' from 'serious' Request was from Chong Yidong <cyd <at> stupidchicken.com> to control <at> debbugs.gnu.org. (Sat, 17 Apr 2010 16:00:03 GMT) Full text and rfc822 format available.

Severity set to 'normal' from 'important' Request was from Chong Yidong <cyd <at> gnu.org> to control <at> debbugs.gnu.org. (Thu, 31 May 2012 15:10:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org:
bug#5786; Package emacs,cc-mode. (Fri, 25 Dec 2015 23:06:02 GMT) Full text and rfc822 format available.

Message #19 received at 5786 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: 5786 <at> debbugs.gnu.org, Alan Mackenzie <acm <at> muc.de>,
 Daniel Colascione <daniel <at> censorshipresearch.org>
Subject: Re: bug#5786: new cc-mode <>-matching barfs in complex case
Date: Sat, 26 Dec 2015 00:04:36 +0100
Chong Yidong <cyd <at> stupidchicken.com> writes:

>> Note: Although the trace below is from Emacs 22, I'm using cc-mode from
>> HEAD. It doesn't affect the bug.
>>
>> cc-mode seems to barf in certain cases on files with lots of template
>> brackets. I can't quite figure out what's wrong with it: the testcase
>> below is about as small as I could make it.
>>
>> To reproduce: load the following file in c++-mode, position point at
>> line 3, column 6 (just after the "/*"), and press space. It's
>> important not to scroll around the buffer first. You'll see a
>> backtrace
>
> I can't reproduce the bug using emacs-23 branch (nor with the 23.1.95
> pretest), starting from `emacs -Q'.
>
> Daniel, could you please check if a 23.1.95 build from
> ftp://alpha.gnu.org/gnu/emacs/pretest/ has this problem?
>
> If so, please provide an even more exact recipe, sending the test file
> as an attachement and providing precise steps starting from `emacs -Q'.

More information was requested, but no response was given within a few
months, so I'm closing this bug report.  If the problem still exists,
please reopen this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug closed, send any further explanations to 5786 <at> debbugs.gnu.org and Daniel Colascione <daniel <at> censorshipresearch.org> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 25 Dec 2015 23:06:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 23 Jan 2016 12:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 150 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.