gcc's C parser bitten by error recovery changes in bison 1.50

Akim Demaille akim@epita.fr
Wed Oct 16 04:21:00 GMT 2002


>>>>> "Zack" == Zack Weinberg <zack@codesourcery.com> writes:

>> Wow...  I do hope that you don't care :( But if you really do want
>> to do that, you want to apply a patch similar to the reverse of:

Zack> Um, I think you misunderstand.  Assuming that we care, I don't
Zack> want to change bison.simple.  I want to adjust the rules in
Zack> GCC's .y file so that it behaves the same way under both error
Zack> recovery schemes.

Ah, yes, I misunderstood, sorry.

Well, I don't know.  I suppose the best means to ``fix'' this is to
introduce another error recovery rule.  I managed to get the
following:


gcc/build/gcc % ./cc1 /tmp/foo.c                                  nostromo 13:18
 a_translate
/tmp/foo.c: Dans la fonction «a_translate»:
/tmp/foo.c:7: error: erreur d'analyse syntaxique before '{' token
/tmp/foo.c:11: error: `p_addr' undeclared (first use in this function)
/tmp/foo.c:11: error: (Each undeclared identifier is reported only once
/tmp/foo.c:11: error: for each function it appears in.)

Temps d'exécution (secondes)
 parser                :   0.01 (100%) usr   0.00 ( 0%) sys   0.00 ( 0%) wall
 TOTAL                 :   0.01             0.01             0.25
gcc/build/gcc % LC_ALL=C ./cc1 /tmp/foo.c                         nostromo Err 1
 a_translate
/tmp/foo.c: In function `a_translate':
/tmp/foo.c:7: error: parse error before '{' token
/tmp/foo.c:11: error: `p_addr' undeclared (first use in this function)
/tmp/foo.c:11: error: (Each undeclared identifier is reported only once
/tmp/foo.c:11: error: for each function it appears in.)

Execution times (seconds)
 parser                :   0.01 (50%) usr   0.00 ( 0%) sys   0.00 ( 0%) wall
 TOTAL                 :   0.02             0.00             0.25


with the following code.  Obviously, the code of my action is quire
random: I tried to use $$ = error_mark_node, but the compiler rejects
it later.  So I copied the real code from do-while:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: f.patch
Type: text/x-patch
Size: 705 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-bugs/attachments/20021016/b1aca5e5/attachment.bin>


More information about the Gcc-bugs mailing list