Skip to content

[Bug] NDK's openmp test crashing on x86 with latest LLVM update #2041

Closed
@DanAlbert

Description

@DanAlbert

Description

https://android.googlesource.com/platform/ndk/+/refs/heads/main/tests/device/openmp/ and https://android.googlesource.com/platform/ndk/+/refs/heads/main/tests/device/openmp_shared/jni are both failing when I update to clang-r530567. There are four sub tests (two of which are identical aside from whether they use the static or shared openmp, the other two are both static openmp) that do pretty trivial things, but all are crashing on 32-bit x86.

Repro steps (you'll need to download the NDK from the artifacts on https://android-review.googlesource.com/c/platform/ndk/+/3168418 unless you want to build it yourself, prebuilts/clang doesn't have a sysroot so can't build it without the rest of the NDK):

$ ndk/toolchains/llvm/prebuilt/$HOST/bin/clang -target i686-linux-android21 ndk/tests/device/openmp/jni/openmp.c -fopenmp -static-openmp -o omp_test
$ adb push omp_test /data/local/tmp/
$ adb shell "/data/local/tmp/omp_test; echo $?"

I think you should also be able to download the ndk-tests.tar.bz2 artifact to get the test executables if you don't need to rebuild them.

Logcat says:

--------- beginning of crash
07-11 13:52:20.771 13475 13475 F libc    : Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x48 in tid 13475 (fib), pid 13475 (fib)
--------- beginning of main
07-11 13:52:20.778 13478 13478 I crash_dump32: obtaining output fd from tombstoned, type: kDebuggerdTombstone
07-11 13:52:20.779  1851  1851 I /system/bin/tombstoned: received crash request for pid 13475
07-11 13:52:20.779 13478 13478 I crash_dump32: performing dump of process 13475 (target tid = 13475)
07-11 13:52:20.780 13478 13478 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
07-11 13:52:20.780 13478 13478 F DEBUG   : Build fingerprint: 'google/sdk_goog3_x86/generic_x86:10/QSR1.211112.003/8112140:userdebug/test-keys'
07-11 13:52:20.780 13478 13478 F DEBUG   : Revision: '0'
07-11 13:52:20.780 13478 13478 F DEBUG   : ABI: 'x86'
07-11 13:52:20.780 13478 13478 F DEBUG   : Timestamp: 2024-07-11 13:52:20-0700
07-11 13:52:20.781 13478 13478 F DEBUG   : pid: 13475, tid: 13475, name: fib  >>> ./fib <<<
07-11 13:52:20.781 13478 13478 F DEBUG   : uid: 0
07-11 13:52:20.781 13478 13478 F DEBUG   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x48
07-11 13:52:20.781 13478 13478 F DEBUG   : Cause: null pointer dereference
07-11 13:52:20.781 13478 13478 F DEBUG   :     eax 5ba343f0  ebx 00000000  ecx 00000000  edx 00000000
07-11 13:52:20.781 13478 13478 F DEBUG   :     edi 00000000  esi 5ba343cc
07-11 13:52:20.781 13478 13478 F DEBUG   :     ebp ffad14a8  esp ffad145c  eip 5ba2fac0
07-11 13:52:20.781 13478 13478 F DEBUG   : 
07-11 13:52:20.781 13478 13478 F DEBUG   : backtrace:
07-11 13:52:20.781 13478 13478 F DEBUG   :       #00 pc 000acac0  /data/local/tmp/tests/x86-21-legacy-weakapi/cmake/openmp/x86/fib (BuildId: 8b41cd5b37adb209bc0f739b1bbb54243ca655b1)
07-11 13:52:20.781 13478 13478 F DEBUG   :       #01 pc 00071281  /data/local/tmp/tests/x86-21-legacy-weakapi/cmake/openmp/x86/fib (__kmp_query_cpuid+305) (BuildId: 8b41cd5b37adb209bc0f739b1bbb54243ca655b1)
07-11 13:52:20.781 13478 13478 F DEBUG   :       #02 pc 000a32e6  /data/local/tmp/tests/x86-21-legacy-weakapi/cmake/openmp/x86/fib (__kmp_runtime_initialize+54) (BuildId: 8b41cd5b37adb209bc0f739b1bbb54243ca655b1)
07-11 13:52:20.781 13478 13478 F DEBUG   :       #03 pc 0002b427  /data/local/tmp/tests/x86-21-legacy-weakapi/cmake/openmp/x86/fib (__kmp_do_serial_initialize()+359) (BuildId: 8b41cd5b37adb209bc0f739b1bbb54243ca655b1)
07-11 13:52:20.781 13478 13478 F DEBUG   :       #04 pc 00034fa4  /data/local/tmp/tests/x86-21-legacy-weakapi/cmake/openmp/x86/fib (__kmp_do_middle_initialize()+36) (BuildId: 8b41cd5b37adb209bc0f739b1bbb54243ca655b1)
07-11 13:52:20.781 13478 13478 F DEBUG   :       #05 pc 00034f62  /data/local/tmp/tests/x86-21-legacy-weakapi/cmake/openmp/x86/fib (__kmp_middle_initialize+66) (BuildId: 8b41cd5b37adb209bc0f739b1bbb54243ca655b1)
07-11 13:52:20.782 13478 13478 F DEBUG   :       #06 pc 000a6152  /data/local/tmp/tests/x86-21-legacy-weakapi/cmake/openmp/x86/fib (omp_get_num_procs+50) (BuildId: 8b41cd5b37adb209bc0f739b1bbb54243ca655b1)
07-11 13:52:20.782 13478 13478 F DEBUG   :       #07 pc 0001f66c  /data/local/tmp/tests/x86-21-legacy-weakapi/cmake/openmp/x86/fib (main+140) (BuildId: 8b41cd5b37adb209bc0f739b1bbb54243ca655b1)
07-11 13:52:20.782 13478 13478 F DEBUG   :       #08 pc 000898e8  /apex/com.android.runtime/lib/bionic/libc.so (__libc_init+120) (BuildId: 471745f0fbbcedb3db1553d5bd6fcd8b)

That's from an API 28 x86 emulator I got from go/xcid.

I've only tested on Darwin, but I expect this isn't host-specific.

Upstream bug

No response

Commit to cherry-pick

No response

Affected versions

Canary

Canary version

not actually submitted yet, clang-r530567

Host OS

Mac

Host OS version

all, probably

Affected ABIs

x86

Metadata

Metadata

Labels

Type

No type

Projects

Status

Prebuilts submitted

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions