Opened 9 years ago
Last modified 7 years ago
#8863 new Bugs
BOOST_ATTRIBUTE_NORETURN causes stack pointer corruption
Reported by: | Owned by: | Emil Dotchevski | |
---|---|---|---|
Milestone: | To Be Determined | Component: | exception |
Version: | Boost 1.49.0 | Severity: | Problem |
Keywords: | exception throw_exception BOOST_ATTRIBUTE_NORETURN stack-pointer | Cc: |
Description
Hello, i ran into a strange problem with a very small project of mine. Whenever an exception is thrown in a boost package using boost::throw_exception and my program terminates (no exceptions are beeing catched yet) i get a message box saying:
Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call ...
I was able to track this down to the BOOST_ATTRIBUTE_NORETURN declaration of boost::throw_exception. When i remove this from a copy of this function, the problem disappears.
I am compiling with the following settings:
- Compiler: MS Visual Studio C++ 2010 Express
- Multithreading: yes
- Runtime-linking: static
- Build-type: debug
My minimal test-program looks like this:
#include "boost/throw_exception.hpp"
int main(int argc, char* argv[]) {
boost::throw_exception(std::exception("foo")); <-- this will produce the problem
return 0;
}
I originally asked about the problem here: http://stackoverflow.com/questions/17599772/boost-exceptions-lead-to-stack-pointer-corruption-run-time-check-failure-0
Change History (4)
comment:1 by , 9 years ago
Version: | Boost 1.54.0 → Boost 1.49.0 |
---|
comment:2 by , 9 years ago
comment:3 by , 7 years ago
This issue is still there for Boost 1.60.0 under MSVC2015.2 (configuration=Debug, platform=x86).
comment:4 by , 7 years ago
Note: the "minimal test-program" fails (with "The value of ESP..."), libs/exception/test/1-throw_exception_test.cpp does not.
I ran your program against the current trunk revision of Boost and it worked fine. I was going to add this as a test in Boost Exception, however I realized that the string constructor of std::exception is not standard, so I didn't.
It probably makes sense for you to run libs/exception/test/1-throw_exception_test.cpp with your setup. If that crashes too, then most likely the problem is specific to your system.