Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Bug]: Miscompilation on armv7 with NDK r25c #1860

@ngg

Description

@ngg

Description

When we tried to switch from NDK r24 to r25c, our application has started to crash when compiled to armv7.

Unfortunately, I couldn't easily minimize our code to submit it here, but I managed to reproduce the same crash on armv7 Linux using upstream clang 15.0.7. Updating clang to 16.0.1 solved the crash, so I bisected the llvm-project repo to find that the necessary commit for the fix is llvm/llvm-project@8a09875. The fix itself is not armv7 specific, I assume it can cause problems on any platform.

I found a discussion here https://discourse.llvm.org/t/instcombine-struct-w-padding-aggregate-loads-stores-as-scalars/67035/5 that describes the issue and has small testcases that can reproduce the miscompilation, but on CUDA target. I don't have a small isolated testcase for Android, I hope the information I'm providing here is enough.

I tried to cherry-pick the commit onto llvm/llvm-project@282c83c which clang-r450784d1 is based on which is included in NDK r25c, there is a conflict in the test case that this fix modifies but the fix itself in llvm/lib/Analysis/InstructionSimplify.cpp is ok and works, it no longer crashes.

Please cherry-pick the llvm/llvm-project@8a09875 commit into the next NDK release.

Upstream bug

llvm/llvm-project#59156

Commit to cherry-pick

llvm/llvm-project@8a09875

Affected versions

r25

Canary version

No response

Host OS

Linux

Host OS version

Debian 11

Affected ABIs

armeabi-v7a

Metadata

Metadata

Labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions