https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122344

            Bug ID: 122344
           Summary: It is not possible to use modules with thread
                    sanitizer
           Product: gcc
           Version: 15.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: d7d1cd at mail dot ru
  Target Milestone: ---

Here's the module code:
module;
#include <memory>
export module M;
export auto make_unique_int() {
return std::unique_ptr<int>{};
}

If compiled with the -fsanitize=thread flag, it will cause an error in the
sanitizer:
error: 'template<class _Tp> std::_Sp_atomic< <template-parameter-1-1>
>::_Atomic_count::~_Atomic_count()' exposes TU-local entity
'__tsan_mutex_not_static'
421 | ~_Atomic_count()
| ^

tsan_interface.h:50:23: note: '__tsan_mutex_not_static' declared with internal
linkage
50 | static const unsigned __tsan_mutex_not_static = 1 << 8;
| ^~~~~~~~~~~~~~~~~~~~~~~~~

Perhaps it's incorrect to make a static constant in the header. Or is it
necessary for the sanitizer to function properly?

Reply via email to