<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/61983>61983</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Runtime error when using UBSan with bfloat16 conversion intrinsic
</td>
</tr>
<tr>
<th>Labels</th>
<td>
backend:AArch64,
miscompilation
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ostannard
</td>
</tr>
</table>
<pre>
When this code is compiled for AArch64 with UBSan, it reports a UBSan error, even though this is valid code:
```c
#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
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8VV2v4yYQ_TXkZYSF8UechzwkN5u-VK3U1aqPFoaxTReDBTh37_76yh_JZqNtrStzA2cOw5xjRoSgO4t4JMWZFJedmGLv_NGFKKwVXu0apz6Of_doIfY6gHQKYRmHURtU0DoPp5OXfZnDu449fDl_FpbwN9ARPI7OxwBinQX03vl5DW8LoZu6fuXVAW7CaLVsQLITYRfC7u-SrX9y-80zbaWZFALJ3oQfaovOJj3JPj2HtcaJ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