GNU bug report logs -
#59426
29.0.50; [tree-sitter] Some functions exceed maximum recursion limit
Previous Next
Reported by: Yuan Fu <casouri <at> gmail.com>
Date: Mon, 21 Nov 2022 00:54:02 UTC
Severity: normal
Found in version 29.0.50
Fixed in version 29.1
Done: Yuan Fu <casouri <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #86 received at 59426 <at> debbugs.gnu.org (full text, mbox):
23 nov. 2022 kl. 19.46 skrev Yuan Fu <casouri <at> gmail.com>:
> It shouldn’t, but tree-sitter thinks some closing brackets are erroneous and skips them when parsing (it skips erroneous tokens in the hope to parse the rest of the file despite local errors). So a 10k wide tree becomes 10k tall.
>
> We can submit a bug repot to tree-sitter-c (“maybe don’t skip closing brackets even there is error, or somthing”), but that’s another story.
Thanks for the explanation. In this case it seems that it's the #line directive that throws a spanner in the works. You probably already discovered that, but for the record, here is a cut-down example:
static hf_register_info hf[] = {
#line 1 "./asn1/rrc/packet-rrc-hfarr.c"
{ &hf_rrc_DL_DCCH_Message_PDU,
{ "DL-DCCH-Message", "rrc.DL_DCCH_Message_element",
FT_NONE, BASE_NONE, NULL, 0,
NULL, HFILL }},
{ &hf_rrc_cellIdentity_c_id,
{"Cell Identifier", "rrc.cellIdentity.c_id",
FT_UINT32, BASE_DEC, NULL, 0,
"The Cell Identifier (C-Id) part of the Cell Identity", HFILL }}
};
Note how the warning colour of the curly brackets vanishes once the #line line is removed.
Even if this snag is corrected, there will always be cases where preprocessor use causes trouble of this or a similar kind. It seems quite convincing that we should void C recursion in favour of explicit stacks where possible.
This bug report was last modified 2 years and 174 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.