[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bison-2.6.4-generated parser triggers pragma warnings in GCC 4.6.3

From: Akim Demaille
Subject: Re: bison-2.6.4-generated parser triggers pragma warnings in GCC 4.6.3
Date: Sun, 28 Oct 2012 18:28:18 +0100

Le 27 oct. 2012 à 17:13, Peter Simons a écrit :

>> That looks good to me.  Thanks for all the work you've been doing!
> Yes, indeed. Thank you very much, Akim, for dealing with this issue so
> quickly and thoroughly!

Well, thanks for reporting :)

Actually, I was not testing thoroughly enough :(  4.8 with -O3
is giving different results, and C++ is affected too.  I will
provide a patch a bit later.

But Paul, we have yet another case where the pragmas do not
suffice.  That's test case 162, GCC says:

> input.c: In function 'yyparse':
> input.y:33:6: error: 'yylval' may be used uninitialized in this function 
> [-Werror=maybe-uninitialized]
>    if (!$$)
>       ^
> input.c:1110:9: note: 'yylval' was declared here
>  YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
>          ^
> cc1: all warnings being treated as errors

The error is in the %destructor:

> // If $$ = 0 here, then we know that the 'a' destructor is being invoked
> // incorrectly for the 'b' set in the semantic action below.  All 'a'
> // tokens are returned by yylex, which sets $$ = 1.
> %destructor {
>   if (!$$)
>     fprintf (stderr, "Wrong destructor.\n");
> } 'a';

But again, yylval is fully initialized in this example
(attached).  I don't feel comfortable with adding
disabling pragmas around user code, but it looks like
what GCC would want.  What would you suggest?

Attachment: input.y
Description: Binary data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]