Code below causes compiler crash during compilation for AArch32 architecture (for AArch64 it works fine). Detailed instruction how to reproduce the issue could be found in this repo.
#include <arm_neon.h>
#include <arm_acle.h>
#include <stdint.h>
#include <stddef.h>
static inline void
prepareInterleavedKeys(
uint8_t* roundKeys
) {
enum {
roundKeySize = 16
};
uint8_t* output = roundKeys;
uint8x16x4_t keys_0_3;
uint8x16x4_t keys_4_7;
uint8x16x3_t keys_8_10;
uint8x16x4_t buff;
keys_0_3 = vld1q_u8_x4(roundKeys);
keys_4_7 = vld1q_u8_x4(roundKeys + roundKeySize * 4);
keys_8_10 = vld1q_u8_x3(roundKeys + roundKeySize * 8);
for(size_t i = 0; i < 4u; ++i) {
buff.val[0] = keys_0_3.val[i];
buff.val[1] = keys_0_3.val[i];
buff.val[2] = keys_0_3.val[i];
buff.val[3] = keys_0_3.val[i];
vst1q_u8_x4(output, buff);
output += roundKeySize * 4;
}
for(size_t i = 0; i < 4u; ++i) {
buff.val[0] = keys_4_7.val[i];
buff.val[1] = keys_4_7.val[i];
buff.val[2] = keys_4_7.val[i];
buff.val[3] = keys_4_7.val[i];
vst1q_u8_x4(output, buff);
output += roundKeySize * 4;
}
for(size_t i = 0; i < 3u; ++i) {
buff.val[0] = keys_8_10.val[i];
buff.val[1] = keys_8_10.val[i];
buff.val[2] = keys_8_10.val[i];
buff.val[3] = keys_8_10.val[i];
vst1q_u8_x4(output, buff);
output += roundKeySize * 4;
}
}
int main(void) {
uint8_t keys[704] = {0};
prepareInterleavedKeys(keys);
}
OS: Ubuntu 20.04.2 LTS
Clang version:
$: /opt/android-ndk-r22b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -v
Android (7155654, based on r399163b1) clang version 11.0.5 (https://android.googlesource.com/toolchain/llvm-project 87f1315dfbea7c137aa2e6d362dbb457e388158d)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/android-ndk-r22b/toolchains/llvm/prebuilt/linux-x86_64/bin
Found candidate GCC installation: /opt/android-ndk-r22b/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/i686-linux-android/4.9.x
Found candidate GCC installation: /opt/android-ndk-r22b/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/x86_64-linux-android/4.9.x
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
Compilation ERROR
"/opt/android-ndk-r22b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang" --target=armv7a-linux-androideabi23 -c -fPIC -std=c99 -Wall -Wextra -Wno-unused-label -fPIC -fvisibility=hidden -O3 -Werror -g -DNDEBUG -mfpu=neon -mfloat-abi=hard ./test.c -o ./test.o
PLEASE submit a bug report to https://github.com/android-ndk/ndk/issues and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /opt/android-ndk-r22b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi23 -c -fPIC -std=c99 -Wall -Wextra -Wno-unused-label -fPIC -fvisibility=hidden -O3 -Werror -g -DNDEBUG -mfpu=neon -mfloat-abi=hard ./test.c -o ./test.o
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module './test.c'.
4. Running pass 'ARM Instruction Selection' on function '@main'
#0 0x0000000003456ac5 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/opt/android-ndk-r22b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x3456ac5)
#1 0x0000000003456960 llvm::sys::RunSignalHandlers() (/opt/android-ndk-r22b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x3456960)
#2 0x0000000003425250 (/opt/android-ndk-r22b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x3425250)
#3 0x000000000342540c (/opt/android-ndk-r22b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x342540c)
#4 0x00007f92757c13c0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
#5 0x0000000002ae0fe4 (/opt/android-ndk-r22b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+0x2ae0fe4)
clang: error: clang frontend command failed due to signal (use -v to see invocation)
Android (7155654, based on r399163b1) clang version 11.0.5 (https://android.googlesource.com/toolchain/llvm-project 87f1315dfbea7c137aa2e6d362dbb457e388158d)
Target: armv7a-unknown-linux-android23
Thread model: posix
InstalledDir: /opt/android-ndk-r22b/toolchains/llvm/prebuilt/linux-x86_64/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: /tmp/test-dd13a1.c
clang: note: diagnostic msg: /tmp/test-dd13a1.sh
clang: note: diagnostic msg:
********************
make: *** [Makefile:2: all] Error 254
Code below causes compiler crash during compilation for AArch32 architecture (for AArch64 it works fine). Detailed instruction how to reproduce the issue could be found in this repo.
OS: Ubuntu 20.04.2 LTS
Clang version:
Compilation ERROR