Skip to content

Failed to compile 128-bit tests using clang on mac #584

@Souvenal

Description

@Souvenal

Platform:

Kernel: arm64-apple-darwin25.0.0
Chip: Apple M4
Clang: 20.1.5
Issue:
When running EASTL benchmarks and tests locally, I encountered compilation errors related to 128-bit integer support.

If I enable both benchmark and test targets, I get errors like:

error: no member named 'fetch_add' in 'eastl::atomic<unsigned __int128>'
__uint128_t val = atomic.fetch_add(1, eastl::memory_order_relaxed);

After investigation, I found that template specialization does not recognize __uint128_t as an integral type. This seems to be due to the following code in eacompilertraits.h:

#if (defined(__GNUC__) && defined(__x86_64__))
    #define EA_COMPILER_INTMAX_SIZE 16  // intmax_t is __int128_t (GCC extension) and is 16 bytes.
#else
    #define EA_COMPILER_INTMAX_SIZE 8   // intmax_t is int64_t and is 8 bytes.
#endif

which does not correctly define the size for my platform.

Even after manually setting the correct size, I encountered further issues with numeric_limits specialization. It seems that Clang and GCC use different names for 128-bit integer types, and I am not familiar with cross-compiler settings for this.

For now, I have disabled 128-bit tests to allow compilation.

Question:
Is there a recommended way to support 128-bit integer atomics and numeric limits across Clang and GCC? Can this be fixed in EASTL for better cross-compiler compatibility?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions