Compile error in SSL2Parser.cpp
powerbf opened this issue · 4 comments
OS: Linux Mint 19
Output of 'boomerang-cli --version' (can't build it)
Steps to reproduce:
- make
Expected/desired behaviour
Should build.
Develop branch was building a couple of days ago for me.
I haven't updated any of my tools, but now I am getting a compile error in SSL2Parser.cpp, which appears to be generated from SSL2Parser.y.
SSL2Parser.y was recently added on the develop branch.
Actual behaviour
I get the following error:
[ 0%] [FLEX][SSL2Scanner] Building scanner with flex 2.6.4
[ 1%] [BISON][SSL2Parser] Building parser with bison 3.0.4
/home/brian/workspace/github/boomerang/src/boomerang/ssl/parser/SSL2Parser.y: warning: 147 shift/reduce conflicts [-Wconflicts-sr]
Scanning dependencies of target boomerang-ssl2-parser
[ 1%] Building CXX object src/boomerang/ssl/parser/CMakeFiles/boomerang-ssl2-parser.dir/SSL2Parser.cpp.o
/home/brian/workspace/github/boomerang/src/boomerang/ssl/parser/SSL2Parser.cpp: In member function ‘virtual std::_cxx11::string yy::parser::yysyntax_error(yy::parser::state_type, const symbol_type&) const’:
/home/brian/workspace/github/boomerang/src/boomerang/ssl/parser/SSL2Parser.cpp:2241:38: error: potential null pointer dereference [-Werror=null-dereference]
for (char const* yyp = yyformat; *yyp; ++yyp)
^~~~
cc1plus: all warnings being treated as errors
src/boomerang/ssl/parser/CMakeFiles/boomerang-ssl2-parser.dir/build.make:73: recipe for target 'src/boomerang/ssl/parser/CMakeFiles/boomerang-ssl2-parser.dir/SSL2Parser.cpp.o' failed
make[2]: *** [src/boomerang/ssl/parser/CMakeFiles/boomerang-ssl2-parser.dir/SSL2Parser.cpp.o] Error 1
CMakeFiles/Makefile2:393: recipe for target 'src/boomerang/ssl/parser/CMakeFiles/boomerang-ssl2-parser.dir/all' failed
make[1]: *** [src/boomerang/ssl/parser/CMakeFiles/boomerang-ssl2-parser.dir/all] Error 2
Makefile:151: recipe for target 'all' failed
make: *** [all] Error 2
Additional comments
gcc --version reports:
gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
$ flex --version
flex 2.6.4
$ bison --version
bison (GNU Bison) 3.0.4
BTW, it's not clear from the pasted error because it stripped whitespace when I pasted it, but the caret is pointing to the 2nd term in the for loop (i.e. *yyp).
This is a "bug" in bison; the grammar generated by 3.0.4 causes a null pointer dereference warning when compiled with GCC 7. This is fixed with Bison 3.0.5 (see https://lists.gnu.org/archive/html/bug-bison/2018-05/msg00034.html). As a temporary workaround you can specify BOOMERANG_ADD_COMPILE_FLAGS(-Wno-error=nullptr-dereference)
in cmake-scripts/boomerang-flags.cmake
or compile with clang.