Running bnfc-system-tests, I observed that the C++ AST printer for examples/GF/gf.cf https://github.com/BNFC/bnfc/blob/master/examples/GF/gf.cf segfaults when run on examples/GF/example.gf https://github.com/BNFC/bnfc/blob/master/examples/GF/example.gf .
I do not want to debug this. A brief look into the generated printer shows that it has inline functions and destructive update of a buf_ variable.
|
" void inline resizeBuffer(void)", |
|
" {", |
|
" char *temp = (char *) malloc(buf_size);", |
|
" if (!temp)", |
|
" {", |
|
" fprintf(stderr, \"Error: Out of memory while attempting to grow buffer!\\n\");", |
|
" exit(1);", |
|
" }", |
|
" if (buf_)", |
|
" {", |
|
" strcpy(temp, buf_);", |
|
" free(buf_);", |
|
" }", |
|
" buf_ = temp;", |
|
" }", |
|
" char *buf_;", |
|
" int cur_, buf_size;", |
|
"};", |
I leave this to C++ enthusiasts and fans of pointer manipulations. Happy segfaulting!
$ g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin18.0.0
Thread model: posix
Running
bnfc-system-tests, I observed that the C++ AST printer forexamples/GF/gf.cfhttps://github.com/BNFC/bnfc/blob/master/examples/GF/gf.cf segfaults when run onexamples/GF/example.gfhttps://github.com/BNFC/bnfc/blob/master/examples/GF/example.gf .I do not want to debug this. A brief look into the generated printer shows that it has inline functions and destructive update of a
buf_variable.bnfc/source/src/BNFC/Backend/CPP/PrettyPrinter.hs
Lines 146 to 163 in 344ccde
I leave this to C++ enthusiasts and fans of pointer manipulations. Happy segfaulting!