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

Oliver Stannard via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 4 04:38:47 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) {
----------------
ostannard wrote:

There is already a range check in `ARMAsmBackend::reasonForFixupRelaxation`, it would be better to fix that one than to add a new check here.

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


More information about the llvm-commits mailing list