diff --git a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp --- a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp +++ b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp @@ -2658,11 +2658,10 @@ } } } else if (IsUnconditionalBranch) { - // TODO: Consider making the `call [offset fn_ref]` syntax an error? -#if 0 + // Treat `call [offset fn_ref]` (or `jmp`) syntax as an error. if (!PtrInOperand && SM.isOffsetOperator()) - return Error(Start, "`OFFSET` operator cannot be used in an unconditional branch"); -#endif + return Error( + Start, "`OFFSET` operator cannot be used in an unconditional branch"); if (PtrInOperand || SM.isBracketUsed()) MaybeDirectBranchDest = false; } diff --git a/llvm/test/MC/X86/intel-syntax-branch-fail.s b/llvm/test/MC/X86/intel-syntax-branch-fail.s --- a/llvm/test/MC/X86/intel-syntax-branch-fail.s +++ b/llvm/test/MC/X86/intel-syntax-branch-fail.s @@ -1,10 +1,9 @@ // RUN: not llvm-mc -triple i686-unknown-unknown -x86-asm-syntax=intel %s 2>&1 | FileCheck %s -// TODO: Consider making this syntax an error? -// call [offset fn_ref] -// // TODO-CHECK: {{.*}}intel-syntax-branch-fail.s:[[#@LINE+-1]]:1: error: `OFFSET` operator cannot be used in an unconditional branch -// jmp [offset fn_ref] -// // TODO-CHECK: {{.*}}intel-syntax-branch-fail.s:[[#@LINE+-1]]:1: error: `OFFSET` operator cannot be used in an unconditional branch +call [offset fn_ref] +// CHECK: {{.*}}intel-syntax-branch-fail.s:[[#@LINE+-1]]:6: error: `OFFSET` operator cannot be used in an unconditional branch +jmp [offset fn_ref] +// CHECK: {{.*}}intel-syntax-branch-fail.s:[[#@LINE+-1]]:5: error: `OFFSET` operator cannot be used in an unconditional branch call offset fn_ref // CHECK: {{.*}}intel-syntax-branch-fail.s:[[#@LINE+-1]]:1: error: invalid operand for instruction diff --git a/llvm/test/MC/X86/intel-syntax-branch.s b/llvm/test/MC/X86/intel-syntax-branch.s --- a/llvm/test/MC/X86/intel-syntax-branch.s +++ b/llvm/test/MC/X86/intel-syntax-branch.s @@ -57,13 +57,4 @@ // CHECK-32: calll *fn_ref // CHECK-32: jmpl *fn_ref - t7: - // FIXME: MASM does not accept this syntax and GAS assembles this as a direct - // call/jump instead of indirect. Consider making this syntax an error? - call [offset fn_ref] - jmp [offset fn_ref] - // CHECK-32-LABEL: t7: - // CHECK-32: calll *fn_ref - // CHECK-32: jmpl *fn_ref - .endif