[compiler-rt] [compiler-rt] Work around incompatible Windows definitions of (S)SIZE_T (PR #106311)

Alexander Richardson via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 5 17:17:14 PDT 2024


arichardson wrote:

> We're seeing a build failures on Mac LLVM compile like: .... .../llvm-project/compiler-rt/lib/interception/interception_type_test.cpp:26:17: error: static assertion failed due to requirement '__sanitizer::is_same<long, int>::value': 26 | COMPILER_CHECK((__sanitizer::is_same<::PTRDIFF_T, ::ptrdiff_t>::value)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .../llvm-project/compiler-rt/lib/interception/../sanitizer_common/sanitizer_internal_defs.h:362:44: note: expanded from macro 'COMPILER_CHECK' 362 | #define COMPILER_CHECK(pred) static_assert(pred, "") | ^~~~ 1 error generated. ....
> 
> I'm trying to reproduce it locally - but until I do and figure out why exactly it is happening in our configuration, would you consider reverting? Thanks

It sounds like on macos 32 bit ptrdiff_t is int rather than long. You could replace `COMPILER_CHECK((__sanitizer::is_same<::PTRDIFF_T, ::ptrdiff_t>::value));` with the previous `COMPILER_CHECK(sizeof(::PTRDIFF_T) == sizeof(ptrdiff_t));`. The real fix would be to define `PTRDIFF_T` as int for your 32-bit configuration.

Can you tell me which target you are building for?

https://github.com/llvm/llvm-project/pull/106311


More information about the llvm-commits mailing list