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

            Bug ID: 109882
           Summary: -fsanitize=thread #include <memory> transitively
                    includes sanitizer/common_interface_defs.h
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ed at catmur dot uk
  Target Milestone: ---

Since 12.3.0, when compiled under tsan (-fsanitize=thread), #include <memory>
transitively includes sanitizer/common_interface_defs.h:

#include <memory>
#if defined SANITIZER_COMMON_INTERFACE_DEFS_H
#error :(
#endif

This is problematic for us because sanitizer/common_interface_defs.h has
#define __has_feature(x) 0
https://github.com/gcc-mirror/gcc/blame/5d85b5d649fff675ff00adcc99371bccf4ef5944/libsanitizer/include/sanitizer/common_interface_defs.h#L20

which makes our sanitizer detector incorrectly believe that __has_feature is
available and that tsan is not in fact present since
__has_feature(thread_sanitizer) evaluates to 0.

We will fix the order of checks to put `#ifdef __SANITIZE_THREAD__` first but
thought we should probably report this to help other users.

Reply via email to