help-bison
[Top][All Lists]
Advanced

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

‘void free(void*)’ called on unallocated object ‘yyssa’ [-Wfree-nonheap-


From: Christoph Grüninger
Subject: ‘void free(void*)’ called on unallocated object ‘yyssa’ [-Wfree-nonheap-object]
Date: Mon, 18 Jan 2021 22:01:40 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0

Dear Bison community,
while compiling CMake using GCC 11 (not yet released), I came across several -Wfree-nonheap-object warnings. They came from a file generated by GNU Bison 3.4.2. [1]

I was hoping the error might be fixed in a newer version, so
1. I downloaded your latest release 3.7.4
2. Re-generated the file cmCommandArgumentParser.y with
bison --yacc --name-prefix=cmCommandArgument_yy --defines=cmCommandArgumentParserTokens.h -ocmCommandArgumentParser.cxx cmCommandArgumentParser.y
3. I removed the lines 1717 and 1745 as the label yyerrlab1 must be defined.
4. I recompiled CMake and get the following error:
    Scanning dependencies of target CMakeLib
[ 54%] Building CXX object Source/CMakeFiles/CMakeLib.dir/LexerParser/cmCommandArgumentParser.cxx.o cmCommandArgumentParser.cxx: In function ‘int cmCommandArgument_yyparse(yyscan_t)’: cmCommandArgumentParser.cxx:1838:18: warning: ‘void free(void*)’ called on unallocated object ‘yyssa’ [-Wfree-nonheap-object]
    cmCommandArgumentParser.cxx:1203:16: note: declared here

I attached both the .y and he generated .cxx file.

Is this a known issue? Is the GCC 11 warning wrong (false positive)? I assume not, as yyssa is an array:
    yy_state_t yyssa[YYINITDEPTH];

Can you change Bison that it will generate code that behaves correctly?

Bye
Christoph


[1] CMake issue 21710: gitlab.kitware.com/cmake/cmake/-/issues/21710


--
Als wär es nix, leb' ich von [IT] und mach' nur, was ich lieb'
Lebe wie im Paradies, womit hab' ich das verdient?
Die Wahrheit ist: Hab' ich nicht, ich bin nur reicher beschenkt
Als jemand in einem armen Land mit dem gleichen Talent
[frei nach Tua von Die Orsons - Oioioiropa]

Attachment: cmCommandArgumentParser.y
Description: Text document

Attachment: cmCommandArgumentParser.cxx
Description: Text Data


reply via email to

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