[compiler-rt] [compiler-rt] Fix definition of `uptr` (and `usize`) on 32-bit Windows (PR #106151)

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 27 00:45:02 PDT 2024


mstorsjo wrote:

> This seems to work on MSVC and MinGW: https://godbolt.org/z/s8YWaKaKn but I don't have an environment to test this.

This change breaks builds for i686 mingw like this:
```

In file included from /home/martin/code/llvm-mingw/llvm-project/compiler-rt/lib/interception/interception_win.cpp:132:
In file included from /home/martin/clang-trunk/i686-w64-mingw32/include/windows.h:69:
In file included from /home/martin/clang-trunk/i686-w64-mingw32/include/windef.h:9:
In file included from /home/martin/clang-trunk/i686-w64-mingw32/include/minwindef.h:163:
In file included from /home/martin/clang-trunk/i686-w64-mingw32/include/winnt.h:150:
/home/martin/clang-trunk/i686-w64-mingw32/include/basetsd.h:147:39: error: typedef redefinition with different types ('ULONG_PTR' (aka 'unsigned long') vs '__sanitizer::uptr' (aka 'unsigned int'))
  147 |   __MINGW_EXTENSION typedef ULONG_PTR SIZE_T,*PSIZE_T;
      |                                       ^
/home/martin/code/llvm-mingw/llvm-project/compiler-rt/lib/interception/interception.h:28:30: note: previous definition is here
   28 | typedef __sanitizer::uptr    SIZE_T;
      |                              ^
In file included from /home/martin/code/llvm-mingw/llvm-project/compiler-rt/lib/interception/interception_win.cpp:132:
In file included from /home/martin/clang-trunk/i686-w64-mingw32/include/windows.h:69:
In file included from /home/martin/clang-trunk/i686-w64-mingw32/include/windef.h:9:
In file included from /home/martin/clang-trunk/i686-w64-mingw32/include/minwindef.h:163:
In file included from /home/martin/clang-trunk/i686-w64-mingw32/include/winnt.h:150:
/home/martin/clang-trunk/i686-w64-mingw32/include/basetsd.h:148:38: error: typedef redefinition with different types ('LONG_PTR' (aka 'long') vs '__sanitizer::sptr' (aka 'int'))
  148 |   __MINGW_EXTENSION typedef LONG_PTR SSIZE_T,*PSSIZE_T;
      |                                      ^
/home/martin/code/llvm-mingw/llvm-project/compiler-rt/lib/interception/interception.h:29:30: note: previous definition is here
   29 | typedef __sanitizer::sptr    SSIZE_T;
      |                              ^
2 errors generated.

```

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


More information about the llvm-commits mailing list