diff options
| author | nihui <shuizhuyuanluo@126.com> | 2024-04-29 20:18:37 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-29 13:18:37 +0100 |
| commit | cb3174bd7895535d2f397695b5b20b1e90876997 (patch) | |
| tree | 69bdcafb268eefb43dee73fa2b9f673a6bcd50a6 /lldb/packages/Python/lldbsuite/test/lldbtest.py | |
| parent | 179e174945b6c0da462c534504720c9544aebf84 (diff) | |
| download | llvm-cb3174bd7895535d2f397695b5b20b1e90876997.zip llvm-cb3174bd7895535d2f397695b5b20b1e90876997.tar.gz llvm-cb3174bd7895535d2f397695b5b20b1e90876997.tar.bz2 | |
[clang][CodeGen] fix UB in aarch64 bfloat16 scalar conversion (#89062)
do not bitcast 16bit `bfloat16` to 32bit `int32_t` directly
bitcast to `int16_t`, and then upcast to `int32_t`
Fix ASAN runtime error when calling vcvtah_f32_bf16
`==21842==ERROR: AddressSanitizer: stack-buffer-overflow on address
0x007fda1dd063 at pc 0x005c0361c234 bp 0x007fda1dd030 sp 0x007fda1dd028
`
without patch
```c
__ai __attribute__((target("bf16"))) float32_t vcvtah_f32_bf16(bfloat16_t __p0) {
float32_t __ret;
bfloat16_t __reint = __p0;
int32_t __reint1 = *(int32_t *) &__reint << 16;
__ret = *(float32_t *) &__reint1;
return __ret;
}
```
with this patch
```c
__ai __attribute__((target("bf16"))) float32_t vcvtah_f32_bf16(bfloat16_t __p0) {
float32_t __ret;
bfloat16_t __reint = __p0;
int32_t __reint1 = (int32_t)(*(int16_t *) &__reint) << 16;
__ret = *(float32_t *) &__reint1;
return __ret;
}
```
fix issue https://github.com/llvm/llvm-project/issues/61983
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/lldbtest.py')
0 files changed, 0 insertions, 0 deletions
