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?
input.y
Description: Binary data
