Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-95992

tcmalloc fails to compile on GCC 14.2.0 C++20

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Server Programmability

      Our vendored version of tcmalloc fails to compile on GCC 14.2.0 against the C++20 standard.

      In short, the incompatibility arises due to tcmalloc improperly attempting to initialize a constinit std::atomic<double> with a double literal when the compiler is using the C++20 standard. Compilation succeeds on prior standards because the ABSL_CONST_INIT macro will resolve to empty text when the constinit specifier is not available. When using C++20, constinit becomes available, which causes the macro to resolve to the constinit keyword, and so any variables declared ABSL_CONST_INIT std::atomic<double> and initialized with a double literal result in compile failures.

      The reason that initializing a constinit std::atomic<double> with a double literal results in compile failure is that the single-argument constructor for std::atomic<double> is not declared constexpr and internally invokes runtime-dependent behavior.

            Assignee:
            Unassigned Unassigned
            Reporter:
            james.bronsted@mongodb.com James Bronsted
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: