[clang] [compiler-rt] [ubsan] Display correct runtime messages for negative _BitInt (PR #93612)
Martin Storsjö via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 26 12:07:24 PDT 2024
mstorsjo wrote:
> > Indeed, Clang doesn't provide int128_t for 32 bit targets, AFAIK.
>
> It looks like a little bit more complex. I checked with Standalone-i386 and AddressSanitizer-i386 targets. They do have int128_t for 32 bit targets as soon as clang itself built as 64-bit binary.
That doesn't quite reflect my experience - the bitness of the host compiler binary should not affect what features are available in the target environment:
```
$ file -L bin/clang
bin/clang: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[xxHash]=724b58c4c8ae1673, not stripped
$ bin/clang -target i386-linux-gnu -E -dM - < /dev/null | grep INT128
$ bin/clang -target x86_64-linux-gnu -E -dM - < /dev/null | grep INT128
#define __SIZEOF_INT128__ 16
$ bin/clang -target i386-windows -E -dM - < /dev/null | grep INT128
$ bin/clang -target x86_64-windows -E -dM - < /dev/null | grep INT128
#define __SIZEOF_INT128__ 16
$ cat int128.c
__int128_t a = 42;
$ bin/clang -target x86_64-linux-gnu -c int128.c
$ bin/clang -target i386-linux-gnu -c int128.c
int128.c:1:1: error: unknown type name '__int128_t'
1 | __int128_t a = 42;
| ^
1 error generated.
```
I'm not quite sure what kind of test setup you have - it sounds like it has detected feature based on the compiler's default target, regardless of what the target really supports?
https://github.com/llvm/llvm-project/pull/93612
More information about the cfe-commits
mailing list