We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When this code is compiled for AArch64 with UBSan, it reports a UBSan error, even though this is valid code:
#include <arm_neon.h> float foo(__bf16 a) { return vcvtah_f32_bf16(a); }
$ /work/llvm/build/bin/clang --target=aarch64--none-eabi -march=armv8.2-a+bf16 -c test.c -o - -S -O1 -fsanitize=undefined -fsanitize-minimal-runtime -fno-sanitize-recover .text .file "test.c" .globl foo // -- Begin function foo .p2align 2 .type foo,@function foo: // @foo .cfi_startproc // %bb.0: // %entry stp x29, x30, [sp, #-16]! // 16-byte Folded Spill .cfi_def_cfa_offset 16 mov x29, sp .cfi_def_cfa w29, 16 .cfi_offset w30, -8 .cfi_offset w29, -16 bl __ubsan_handle_type_mismatch_minimal_abort .Lfunc_end0: .size foo, .Lfunc_end0-foo .cfi_endproc // -- End function .ident "clang version 17.0.0 (git@github.com:llvm/llvm-project.git 626b7e5dd249f569203e024141c1a2a0f618df9c)" .section ".note.GNU-stack","",@progbits .addrsig
The text was updated successfully, but these errors were encountered:
@llvm/issue-subscribers-backend-aarch64
Sorry, something went wrong.
[clang][CodeGen] fix UB in aarch64 bfloat16 scalar conversion (#89062)
cb3174b
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 #61983
Fixed by #89062.
No branches or pull requests
When this code is compiled for AArch64 with UBSan, it reports a UBSan error, even though this is valid code:
The text was updated successfully, but these errors were encountered: