This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [c++ PATCH] PR 29087 (ice on valid code)
- From: Mark Mitchell <mark at codesourcery dot com>
- To: Steven Bosscher <stevenb dot gcc at gmail dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sun, 17 Sep 2006 21:38:36 -0700
- Subject: Re: [c++ PATCH] PR 29087 (ice on valid code)
- References: <200609161941.02266.steven@gcc.gnu.org>
Steven Bosscher wrote:
* parser.c (cp_parser_labeled_statement): Return nothing.
Rename to cp_parser_label_for_labeled_statement. Parse only
the label, not the statement.
(cp_parser_statement): Parse the statement of a labeled-statement
from here, using tail recursion.
:REVIEWMAIL: OK
Minor change:
-/* Parse a labeled-statement.
+ This function is only called by cp_parser_statement. We can use
+ this to avoid extremely deep recursion (e.g. PR29087): In this
+ function we only parse up to `statement', and then we return to
+ cp_parser_statement to parse `statement' there. So the bits we
+ parse here are:
Please adjust this comment to retain the description of IN_COMPOUND,
which it looks like you removed. Also, please remove the PR number, as
the comments in the code ought to stand on their own.
Just say something like:
/* Parse the label for a labeled-statement, i.e.:
+ identifier :
+ case constant-expression :
+ case constant-expression ... constant-expression :
+ default :
+
+ When a label is parsed without errors, the label is added to the
+ parse tree by the finish_* functions, so this function doesn't
+ have to return the label. */
The rationale is evident from the manual "restart" in the caller.
Thanks,
--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713