[llvm] Reject invalid BF encoding when target is next instruction (PR #201533)

Hamza Khan via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 4 07:42:25 PDT 2026


================
@@ -882,7 +882,15 @@ unsigned ARMAsmBackend::adjustFixupValue(const MCAssembler &Asm,
       Ctx.reportError(Fixup.getLoc(), FixupDiagnostic);
       return 0;
     }
-    uint32_t out = (((Value - 4) >> 1) & 0xf) << 23;
+
+    int64_t encoded = (Value - 4) >> 1;
+    if (encoded == 0) {
----------------
HamzaKodez wrote:

Thanks for the advice. I've updated the it now to use the existing validation path instead of a separate check in adjustFixupValue.

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


More information about the llvm-commits mailing list