[llvm] [X86][AsmParser] Fix compiler crash on division by zero in MS inline asm (PR #213539)

Phoebe Wang via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 13 23:32:18 PDT 2026


================
@@ -890,6 +890,20 @@ class X86AsmParser : public MCTargetAsmParser {
       default:
         State = IES_ERROR;
         break;
+      case IES_DIVIDE:
+        if (TmpInt == 0) {
+          ErrMsg = "division by zero in assembly expression";
+          State = IES_ERROR;
+          return true;
+        }
+        [[fallthrough]];
----------------
phoebewang wrote:

We need to fall into the below handling starting from 925. `[[fallthrough]]` is used to suppress the -Wimplicit-fallthrough warning.

https://github.com/llvm/llvm-project/pull/213539


More information about the llvm-commits mailing list