ndk icon indicating copy to clipboard operation
ndk copied to clipboard

[Bug] clang frontend crashes on NDK 28.0.11617993

Open yujincheng08 opened this issue 5 months ago • 11 comments

Description

When I try the ci version (see https://ci.android.com/builds/submitted/11617993/win64/latest) of NDK, it crashes on my project. See https://github.com/llvm/llvm-project/issues/86769

Upstream bug

https://github.com/llvm/llvm-project/issues/86769

Commit to cherry-pick

https://github.com/llvm/llvm-project/commit/0f6ed4c394fd8f843029f6919230bf8df8618529

Affected versions

Canary

Canary version

28.0.11617993

Host OS

All

Host OS version

Windows 11

Affected ABIs

armeabi-v7a, arm64-v8a, x86, x86_64

yujincheng08 avatar Mar 25 '24 16:03 yujincheng08

This is also broken with ToT. Building with assertions enabled, I get:

clang: /usr/local/google/work/llvm-monorepo/llvm-project/clang/lib/AST/ExprConstant.cpp:15798: bool clang::Expr::EvaluateAsConstantExpr(EvalResult &, const ASTContext &, ConstantExprKind) const: Assertion `!isValueDependent() && "Expression evaluator can't be called on a dependent expression."' failed.
...
1.      D:/Android/Projects/LSPosed/external/lsplant/lsplant/src/main/jni/include/utils/jni_helper.hpp:179:61: current parser token ';'                                                                           
2.      D:/Android/Projects/LSPosed/external/lsplant/lsplant/src/main/jni/include/utils/jni_helper.hpp:18:1: parsing namespace 'lsplant'                                                                  
3.      D:/Android/Projects/LSPosed/external/lsplant/lsplant/src/main/jni/include/utils/jni_helper.hpp:178:64: parsing function body 'lsplant::JNI_NewStringUTF'                                                  
4.      D:/Android/Projects/LSPosed/external/lsplant/lsplant/src/main/jni/include/utils/jni_helper.hpp:178:64: in compound statement ('{}')     

pirama-arumuga-nainar avatar Mar 25 '24 18:03 pirama-arumuga-nainar

Since this is a regression, triaging for r27. Since it's not fixed upstream yet, it probably won't be fixed in beta 1, but we can still pick it up in beta 2 or RC 1.

DanAlbert avatar Mar 25 '24 19:03 DanAlbert

This works in clang-r510928. So the bisect window is between r510928 and r522817.

pirama-arumuga-nainar avatar Mar 25 '24 21:03 pirama-arumuga-nainar

~Confirmed this is caused by concept. Maybe it's fixed by llvm/llvm-project#83997?~

Never mind. I picked this PR but it still crashes.

yujincheng08 avatar Mar 26 '24 01:03 yujincheng08

Submitted a bug report to upstream: llvm/llvm-project#86769

yujincheng08 avatar Mar 27 '24 05:03 yujincheng08

I check out to e4a4122eb6768b69640173b4c32fd88de4547227: https://github.com/llvm/llvm-project/pull/71040 and can reproduce the crash. And this works in its last commit: e9db60c05e2fb96ff40cbb1f78790abc5de9237e https://github.com/llvm/llvm-project/pull/70991/ .

ZijunZhaoCCK avatar Mar 29 '24 06:03 ZijunZhaoCCK

@ZijunZhaoCCK Please see this: https://github.com/llvm/llvm-project/pull/86914

yujincheng08 avatar Mar 29 '24 06:03 yujincheng08

@DanAlbert @pirama-arumuga-nainar fixed by upstream: https://github.com/llvm/llvm-project/commit/0f6ed4c394fd8f843029f6919230bf8df8618529

yujincheng08 avatar Mar 29 '24 16:03 yujincheng08

@ZijunZhaoCCK please cherry-pick https://github.com/llvm/llvm-project/commit/0f6ed4c394fd8f843029f6919230bf8df8618529 to llvm-toolchain.

pirama-arumuga-nainar avatar Mar 29 '24 17:03 pirama-arumuga-nainar

confirmed fixed in 28.0.11699160

yujincheng08 avatar Apr 11 '24 09:04 yujincheng08

Reopening because I haven't updated the changelog (I didn't know the cherry-pick ever got done, thanks for confirming!)

https://android-review.googlesource.com/c/platform/ndk/+/3037382, but needs to be cherry-picked, and I can't do that yet.

DanAlbert avatar Apr 11 '24 21:04 DanAlbert