Getting SIGABRT signal when calling clBuildProgram

I have a opencl program that composed of 1 .cl file and 16 .h files, it runs perfectly on Nvidia/Intel/Arm Mali device without any problem.

When I tried to port it to my Xiaomi Mi 10, the program crashed at clBuildProgram with SIGABRT.

Android version 12. Platform 31.

After many days of debuging, I found that when I reduced my code from so many .h files into only 3, the build can be passed. Even more ridiculous, there seems to be a limitation of the code lines. In the 4th .h file, deleting some functions would make the build pass, based on it, however, adding a particular lines of code would bring the SIGABRT error , even it’s just simple code like:

if (a>b) return 0;

At some point, this would fail:

if (a>0 || b>0 || c>0 || d>0) return 0;

This would pass:

if (a>0 || b>0) return 0;

This would fail:

if (a>0 || b>0) return 0;

if (c>0 || d>0) return 0;

As I delete some functions before this code block, they three would all pass the build.

Now I suspect there is a limitation of code in the Opencl linker. Anyone has the idea?

By the way, same thing happens to for lib32 and lib64.

The stack:

abort 0x00000072eb698a28
(anonymous namespace)::Verifier::runOnFunction(llvm::Function&) 0x00000071a9c45574
llvm::FPPassManager::runOnFunction(llvm::Function&) 0x00000071a9c35448
llvm::FPPassManager::runOnModule(llvm::Module&) 0x00000071a9c35758
llvm::MPPassManager::runOnModule(llvm::Module&) 0x00000071a9c359c0
llvm::PassManagerImpl::run(llvm::Module&) 0x00000071a9c3654c
clang::clanglib::RunARMPostLinkFixupPasses(llvm::Module&) 0x00000071aadd63ec
clang::clanglib::MinLinkCLRuntime(llvm::MemoryBuffer*, llvm::raw_ostream*) 0x00000071aadd5b84
(anonymous namespace)::BasicCompilation::link() 0x00000071aadf7018
cl_compiler_link_program 0x00000071aadf1eb8
cl_program_link_immediate 0x0000007221331cb8
cl_program_build_immediate 0x0000007221330d5c
cb_build_program 0x000000722133766c
qCLDrvAPI_clBuildProgram 0x0000007226fe2364
build_program cl_context.c:169
cl_context_build_program cl_context.c:234