[llvm] [X86][AsmParser] Fix compiler crash on division by zero in MS inline asm (PR #213539)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 3 05:20:30 PDT 2026
================
@@ -890,6 +890,29 @@ class X86AsmParser : public MCTargetAsmParser {
default:
State = IES_ERROR;
break;
+ case IES_DIVIDE:
+ case IES_MOD: {
+ auto HasError = [&ErrMsg](IntelExprState IES, int64_t TmpInt) {
+ if (TmpInt != 0)
+ return false;
+ switch (IES) {
+ case IES_DIVIDE:
+ ErrMsg = "division by zero in assembly expression";
+ break;
+ case IES_MOD:
+ ErrMsg = "modulo by zero in assembly expression";
+ break;
+ default:
+ llvm_unreachable("unreachable");
+ }
+ return true;
+ };
+ if (HasError(State, TmpInt)) {
----------------
ABWI-Y wrote:
Ok, I removed the lambda and just split the logic into two separate case blocks so they can emit their own error messages directly. Changes are pushed. Please take another look when you get a chance.
https://github.com/llvm/llvm-project/pull/213539
More information about the llvm-commits
mailing list