libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] [cygwin] Fix segfault in C++ exception handling test


From: Charles Wilson
Subject: [PATCH] [cygwin] Fix segfault in C++ exception handling test
Date: Sat, 19 Jun 2010 16:29:45 -0400

* 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]