Infinite loop when parsing simple C snippet.

Bastian Beischer <[email protected]> Thu, 11 Feb 2016 14:49:35 +0100
Newsgroups gmane.emacs.semantic
Message-ID <CAK9AuB_zqXFkTfYGkCuDv6nCfBc7dRXxonYi+Dv_5ni9DeWy+g@mail.gmail.com>
Dear all,

I'm trying to debug a problem with the semantic parser which enters an
infinite loop when parsing the following code:

int A = 1;
int B = 1;
int C = 1;
int D = 1;
int T = (A)+
  (B)+
  (C)+
  (D);

The problem goes away if the parentheses are removed. It also goes away
when the "int D = 1" and the corresponding summand below are removed.

This is my output of "M-x cedet-version"

CEDET Version: 2.0
  Requested File Loaded
  Package Version Version Version
  ----------------------------------------------------------
  cedet: 2.0 nil ok
  eieio: 1.4 nil ok
  semantic: 2.2 nil ok
  srecode: 1.2 nil ok
  ede: 1.2 nil 2.0


C-h f cedet-version RET
  for details on output format.


You can reproduce the issue as follows.

1a) Use cedet shipped with emacs from "emacs-25" branch, the exact SHA1 I
used is edc39c92a798821a931f282236f7f4a79c2b25a1
1b) I also tried with the same emacs build, but using cedet from cedet
git's master branch, commit f6639c6ad2ab1a59ffda2b8952d6b31d9ddaf83c
2) run emacs -Q
3) evaluate (require 'cedet), (require 'semantic)
4) open the buffer with the above contents
5) run (semantic-force-refresh)

The backtrace in the emacs lisp debugger seems to be this:

Debugger entered--Lisp error: (quit)
  semantic-c-lexer(67 70 1 nil)
  semantic-lex(67 70 1 nil)
  #[(vals start end) "@@@A\306\307\211\310\311
\f\n\206\312 $ \"A\242-\207" [vals length depth nonterm end start
type-cast-list nil semantic-parse-stream semantic-lex 1] 6](((67 . 70)) 67
70)
  semantic-parse-stream-default(((INT 45 . 48) (symbol 49 . 50)
(punctuation 51 . 52) (semantic-list 53 . 56) (punctuation 56 . 57)
(semantic-list 60 . 63) (punctuation 63 . 64) (semantic-list 67 . 70)
(punctuation 70 . 71) (semantic-list 74 . 77) (punctuation 77 . 78)) nil)
  semantic-parse-stream(((INT 45 . 48) (symbol 49 . 50) (punctuation 51 .
52) (semantic-list 53 . 56) (punctuation 56 . 57) (semantic-list 60 . 63)
(punctuation 63 . 64) (semantic-list 67 . 70) (punctuation 70 . 71)
(semantic-list 74 . 77) (punctuation 77 . 78)) nil)
  semantic-repeat-parse-whole-stream(((INT 1 . 4) (symbol 5 . 6)
(punctuation 7 . 8) (number 9 . 10) (punctuation 10 . 11) (INT 12 . 15)
(symbol 16 . 17) (punctuation 18 . 19) (number 20 . 21) (punctuation 21 .
22) (INT 23 . 26) (symbol 27 . 28) (punctuation 29 . 30) (number 31 . 32)
(punctuation 32 . 33) (INT 34 . 37) (symbol 38 . 39) (punctuation 40 . 41)
(number 42 . 43) (punctuation 43 . 44) (INT 45 . 48) (symbol 49 . 50)
(punctuation 51 . 52) (semantic-list 53 . 56) (punctuation 56 . 57)
(semantic-list 60 . 63) (punctuation 63 . 64) (semantic-list 67 . 70)
(punctuation 70 . 71) (semantic-list 74 . 77) (punctuation 77 . 78)) nil
nil)
  semantic-parse-region-default(1 79 nil nil nil)
  semantic-parse-region-c-mode(1 79 nil nil nil)
  semantic-parse-region(1 79)
  semantic-fetch-tags()
  semantic-force-refresh()

Which doesn't tell me much without digging into the internals of semantic.
​Any help in debugging this ​would be appreciated!

Best regards
Bastian

-- 
Bastian Beischer
RWTH Aachen University of Technology

@RWTH Aachen
Office: 28 C 203
Phone: +49-241-80-27205
E-mail: [email protected]
Address: I. Physikalisches Institut B, Sommerfeldstr. 14, D-52074 Aachen

@CERN
Office: Bdg 32-4-B12
Phone: +41-22-76-75750
E-mail: [email protected]
Address: CERN, CH-1211 Geneve 23

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140

_______________________________________________
cedet-semantic mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cedet-semantic