<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/58364>58364</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[ARM] Crash compiling for 128 bit integers for Cortex-M55
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
dearlam
</td>
</tr>
</table>
<pre>
Using llvm 15.0.2 (or 14.0.6) compiling code that uses 128 bit integers (with either -fforce-enable-int128 or using MODE TI types) and targeting Cortex-M55 or Cortex-M85 crashes with an Optimizer error at -O2 and -O3 and -Oz optimization levels.
Example reduced from compiler-rt lib/builtins/addvti3.c (which is normally skipped as CRT_HAS_128BIT is not defined)
**clang --save-temps -fomit-frame-pointer --target=arm-none-eabi -mcpu=cortex-m55 -c -O3 addvti3-reduced.c**
'''clang.exe --save-temps -fomit-frame-pointer --target=arm-none-eabi -mcpu=cortex-m55 -c -O3 addvti3-reduced.c
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: c:\\LLVM15\\bin\\clang.exe -cc1 -triple thumbv8.1m.main-none-unknown-eabi -S -save-temps=cwd -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name addvti3-reduced.c -mrelocation-model static -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -fno-verbose-asm -mconstructor-aliases -nostdsysteminc -target-cpu cortex-m55 -target-feature +soft-float-abi -target-feature -crc -target-feature -dotprod -target-feature +dsp -target-feature +mve -target-feature +mve.fp -target-feature +ras -target-feature -fp16fml -target-feature -bf16 -target-feature -sb -target-feature -i8mm -target-feature +lob -target-feature -cdecp0 -target-feature -cdecp1 -target-feature -cdecp2 -target-feature -cdecp3 -target-feature -cdecp4 -target-feature -cdecp5 -target-feature -cdecp6 -target-feature -cdecp7 -target-feature -pacbti -target-feature -hwdiv-arm -target-feature +hwdiv -target-feature +vfp2 -target-feature +vfp2sp -target-feature -vfp3 -target-feature +vfp3d16 -target-feature +vfp3d16sp -target-feature -vfp3sp -target-feature +fp16 -target-feature -vfp4 -target-feature +vfp4d16 -target-feature +vfp4d16sp -target-feature -vfp4sp -target-feature -fp-armv8 -target-feature +fp-armv8d16 -target-feature +fp-armv8d16sp -target-feature -fp-armv8sp -target-feature +fullfp16 -target-feature +fp64 -target-feature -d32 -target-feature -neon -target-feature -crypto -target-feature -sha2 -target-feature -aes -target-feature +strict-align -target-abi aapcs -mfloat-abi soft -Wunaligned-access -fallow-half-arguments-and-returns -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=gdb -fcoverage-compilation-dir=C:\\work\\b-addvti3_m55_crash -resource-dir c:\\LLVM15\\lib\\clang\\15.0.2 -O3 -fdebug-compilation-dir=C:\\work\\b-addvti3_m55_crash -ferror-limit 19 -fmessage-length=120 -fno-signed-char -fgnuc-version=4.2.1 -fcolor-diagnostics -vectorize-loops -vectorize-slp -faddrsig -o addvti3-reduced.s -x ir addvti3-reduced.bc
1. Optimizer
Exception Code: 0xC0000005
#0 0x00007ff715652532 (c:\LLVM15\bin\clang.exe+0x32532)
#1 0x00007ff7163e1336 (c:\LLVM15\bin\clang.exe+0xdc1336)
#2 0x00007ff7156f2ef0 (c:\LLVM15\bin\clang.exe+0xd2ef0)
#3 0x00007ff71604c1ca (c:\LLVM15\bin\clang.exe+0xa2c1ca)
#4 0x00007ff715d465a1 (c:\LLVM15\bin\clang.exe+0x7265a1)
#5 0x00007ff715d4cb29 (c:\LLVM15\bin\clang.exe+0x72cb29)
#6 0x00007ff715d5fde2 (c:\LLVM15\bin\clang.exe+0x73fde2)
#7 0x00007ff715d83b7c (c:\LLVM15\bin\clang.exe+0x763b7c)
#8 0x00007ff715d64641 (c:\LLVM15\bin\clang.exe+0x744641)
#9 0x00007ff715d64305 (c:\LLVM15\bin\clang.exe+0x744305)
#10 0x00007ff715d5d120 (c:\LLVM15\bin\clang.exe+0x73d120)
#11 0x00007ff715d5b709 (c:\LLVM15\bin\clang.exe+0x73b709)
#12 0x00007ff715d5b0a2 (c:\LLVM15\bin\clang.exe+0x73b0a2)
#13 0x00007ff718054881 (c:\LLVM15\bin\clang.exe+0x2a34881)
#14 0x00007ff7162a3485 (c:\LLVM15\bin\clang.exe+0xc83485)
#15 0x00007ff7156a4191 (c:\LLVM15\bin\clang.exe+0x84191)
#16 0x00007ff7162a5b51 (c:\LLVM15\bin\clang.exe+0xc85b51)
#17 0x00007ff7156a3f91 (c:\LLVM15\bin\clang.exe+0x83f91)
#18 0x00007ff7162a21f7 (c:\LLVM15\bin\clang.exe+0xc821f7)
#19 0x00007ff716d75dcf (c:\LLVM15\bin\clang.exe+0x1755dcf)
#20 0x00007ff716d6f491 (c:\LLVM15\bin\clang.exe+0x174f491)
#21 0x00007ff7170f8dc4 (c:\LLVM15\bin\clang.exe+0x1ad8dc4)
#22 0x00007ff717065bc2 (c:\LLVM15\bin\clang.exe+0x1a45bc2)
#23 0x00007ff715df552d (c:\LLVM15\bin\clang.exe+0x7d552d)
#24 0x00007ff715e86bbe (c:\LLVM15\bin\clang.exe+0x866bbe)
#25 0x00007ff715627b1b (c:\LLVM15\bin\clang.exe+0x7b1b)
#26 0x00007ff715624a73 (c:\LLVM15\bin\clang.exe+0x4a73)
#27 0x00007ff71562480f (c:\LLVM15\bin\clang.exe+0x480f)
#28 0x00007ff719808640 (c:\LLVM15\bin\clang.exe+0x41e8640)
#29 0x00007ffdb52c7034 (C:\WINDOWS\System32\KERNEL32.DLL+0x17034)
#30 0x00007ffdb70a26a1 (C:\WINDOWS\SYSTEM32\ntdll.dll+0x526a1)
clang: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 15.0.2
Target: arm-none-unknown-eabi
Thread model: posix
InstalledDir: c:\LLVM15\bin
clang: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: C:\Users\dearlam\AppData\Local\Temp\addvti3-reduced-f8104e.c
clang: note: diagnostic msg: C:\Users\dearlam\AppData\Local\Temp\addvti3-reduced-f8104e.sh
clang: note: diagnostic msg:
********************'''
Compiles fine for Cortex-M4 and x86_64-pc.
addvti3-reduced.c :
'''typedef int ti_int __attribute__((mode(TI)));
typedef unsigned tu_int __attribute__((mode(TI)));
#define compilerrt_abort() __compilerrt_abort_impl(__FILE__, __LINE__, __func__)
void __compilerrt_abort_impl(const char *file, int line,
const char *function);
ti_int __addvti3(ti_int a, ti_int b) {
ti_int s = (tu_int)a + (tu_int)b;
if (b >= 0) {
if (s < a)
compilerrt_abort();
} else {
if (s >= a)
compilerrt_abort();
}
return s;
}'''
WORKAROUND
Disable superword-level parallelism using
_-fno-slp-vectorize_
[B316317_clang_diag.zip](https://github.com/llvm/llvm-project/files/9788136/B316317_clang_diag.zip)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy9WVtv2zoS_jXOC0FDd8kPeUic5JzgpE2RuFvsk0GRlK2tbhApJ-2v3xlKsU1bPqt2gVO4sTwcfTOcG0ejtBY_rr-qvNqQotiVxA3nztwjMy-pW-IG8COaeQvC67LJC-TitZBEb5kmnZKKuF5C0lyTvNJyI1uFd77leksk_JEtoVlWt1xSWbG0kBTY8A7A7ozMT89392T1SPSPRioUxCpBNGs3UuPysm61fKefwhBv-fiVhIS3TG1BvBHFKvLc6LzMf4JA2bbACurRZ8-g0Wd_-P5J6p6N6byuSCF3slDzmXM3c276v_fvrGwKSVopOi4Fydq6HPYuW9pqUuTpzHtIu7wA_UDhBybETuf-nJuNb3O-JbkiVd2WrCh-EPU9bxoAYoosX1brP29e17D_28dVz6WJkFleSQFbP9Zj5uGHFwxsQKliO0m1LBsF5qzLXNOsZaWkTY1WBxvT3mIz_461Ja3qCuzN0pzQkjcdUHlvuBLMSHlvkF5tOmx0znuJtg5x_zFqzOW7_KdUMeK_PN3fvN4T1aUghTCSd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