* tests/exceptions.at (main.cpp:exceptions_in_module): Move dlclose outside catch block; otherwise __cxa_end_catch (part of the cygwin g++ ABI) accesses pointers to data inside unloaded DLL. This is a platform ABI-specific bug, but is likely common to many platforms' g++ and/or other C++ compilers. ---
Pushed. Tested on cygwin, linux, and msys: 94: C++ exception handling ok NOTE: because of a long-standing packaging error on mingw, you have to manually remove lib/gcc/mingw32/4.4.0/libstdc++.la lib/gcc/mingw32/4.4.0/libsupc++.la or libtool is unable to link C++ images. But that's not related to this C++ exceptions issue. Now, there are two additional "errors" that were discovered during this investigation, but they aren't actually exposed by this test. However, for correctness, it seems appropriate to address them as well. The first of these two "errors" will be addressed by an additional patch, posted and discussed here. The second of the two errors will be addressed by documenting under what conditions it WOULD be exposed. This will be rolled in to the patch previously mentioned. -- Chuck tests/exceptions.at | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/tests/exceptions.at b/tests/exceptions.at index 293723c..23442a3 100644 --- a/tests/exceptions.at +++ b/tests/exceptions.at @@ -202,11 +202,17 @@ int exceptions_in_module (void) return 1; } + bool exception_caught = false; try { (*pf) (); } catch (modexc e) { std::cerr << "caught: " << e.what () << '\n'; + exception_caught = true; + } + + if (exception_caught) + { if (lt_dlclose (handle)) { std::cerr << "dlclose failed: " << lt_dlerror () << '\n'; -- 1.7.0.4