Recent improvements to null address warnings notice that for
targets that do not support HAVE_ELF_STYLE_WEAKREF the dummy stub
implementation of __cxa_get_globals() means that the address can
never be null.

Fixed by removing the test for such targets.

tested on i686, x86_64, powerpc-darwin and x86_64-linux.
pushed to master as bootstrap/trivial fix, thanks
Iain

Signed-off-by: Iain Sandoe <i...@sandoe.co.uk>

libitm/ChangeLog:

        * eh_cpp.cc (GTM::gtm_thread::init_cpp_exceptions): If the
        target does not support HAVE_ELF_STYLE_WEAKREF then do not
        try to test the __cxa_get_globals against NULL.
---
 libitm/eh_cpp.cc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libitm/eh_cpp.cc b/libitm/eh_cpp.cc
index 4909427b405..57beb1a147f 100644
--- a/libitm/eh_cpp.cc
+++ b/libitm/eh_cpp.cc
@@ -178,7 +178,11 @@ GTM::gtm_thread::init_cpp_exceptions ()
 {
   // Only save and restore the number of uncaught exceptions if this is
   // actually used in the program.
-  if (__cxa_get_globals != NULL && __cxa_get_globals () != 0)
+  if (
+#if HAVE_ELF_STYLE_WEAKREF
+      __cxa_get_globals != NULL &&
+#endif
+      __cxa_get_globals () != 0)
     cxa_uncaught_count_ptr = &__cxa_get_globals ()->uncaughtExceptions;
   else
     cxa_uncaught_count_ptr = 0;
-- 
2.24.3 (Apple Git-128)

Reply via email to