id summary reporter owner description type status milestone component version severity resolution keywords cc 13370 Qi: Stack Smash with BOOST_SPIRIT_DEBUG defined chrisfriedt@… Joel de Guzman "Hi, I think I've found some code that touches on a boost::spirit soft-spot that causes a stack overflow when BOOST_SPIRIT_DEBUG is defined, but when debug is not defined, just does not work, *specifically* on Linux. I don't pretend to know why it happens, but it works perfectly well on Mac OS X. The only thing I know is that a stack smash is reported by GCC after boost::spirit::qi::parse() is called. I have this body of code that uses boost::spirit and thrift. I'm using TDD with gtest and developing primarily on Mac OS X. Recently, I added CI using GitLab and the Docker runner, so the testsuites are being run in a pseudo-GNU / Linux environment, but then I also tried it in a Linux VM with the same results, so it's definitely somehow related to Linux. I even tried compiling with clang under Linux, with the same results. Sorry for submitting my whole project source, but this is the only way I've been able to trigger it reliably. To build the code install: boost thrift gtest and then run: sh autogen.sh ./configure --enable-debug make ./example/trigger_boost_stack_smash It should be reproducible (i.e. the stack will be smashed) on Linux, but not on Mac OS X. Also, if you remove --enable-debug, clean, and rebuild, then the stack will not be smashed, but the parser will fail under Linux, but not Mac OS X. The listing named below is an example program that triggers the smashed stack. I've reproduced this with GCC versions as old as 4.6 and as recent as 7.2 and have tried it with boost versions 1.58 and 1.65.1 . The thrift version I'm using is 0.11.0. example/trigger_boost_stack_smash.cpp The following two named test suites fail under Linux but pass under Mac OS X. test/test_set_thread.cpp test/test_report_target_status.cpp My code is still pre-alpha, so I haven't released it at all yet... but you might guess it's an Apache Thrift interface to GDB's RSP. I might not have written the best boost::spirit parsers, but regardless, the behaviour should be similar across different compilers and OS's. Please let me know if I can help isolate the problem. I have tried a ton of things, including valgrind, and just have no idea. Also, I'm sure that my code is horrible. Please don't judge me, but feel free to offer better suggestions (using boost::spirit) that do not trigger stack smashes :-) If anyone is able to *not* reproduce the stack smash using Linux, I would also be very curious to hear back about it." Bugs closed To Be Determined spirit Boost 1.65.0 Problem fixed nok.raven@…