Issue 173065
Summary llvm-ml does not accept `equ` followed by `dq ?` or `[r1].MyStruct.`
Labels llvm-tools
Assignees
Reporter nico
    This test addition is motivated by Asm/X86/LzmaDecOpt.asm from the LZMA SDK:

```diff
diff --git a/llvm/test/tools/llvm-ml/expansion.asm b/llvm/test/tools/llvm-ml/expansion.asm
index 344184965f39..ec32c07faa03 100644
--- a/llvm/test/tools/llvm-ml/expansion.asm
+++ b/llvm/test/tools/llvm-ml/expansion.asm
@@ -2,6 +2,14 @@
 
 .code
 
+PTR_FIELD equ dq ?
+
+MyStruct struct
+  my_field PTR_FIELD
+MyStruct ends
+
+GET_STRUCT equ [r1].MyStruct.
+
 num EQU 276
 var TEXTEQU %num
 
@@ -35,4 +43,6 @@ mov eax, var
 ; CHECK: mov eax, 276
 ; CHECK: mov eax, 276
 
+mov eax, GET_STRUCT my_field
+
 end
```

llvm-ml rejects it, but ml64 apparently accepts it.

It looks like ml64 is pretty lenient in what it allows after equ. Per https://learn.microsoft.com/en-us/cpp/assembler/masm/masm-bnf-grammar?view=msvc-170 I think both of these are technically invalid (since dq isn't an expr at all, and the 2nd set of equs are just _expression_ fragments, not full expressions.

Maybe ml64 just does textual replacement of equ and no pre-parsing.

(Upstream issue: https://issues.chromium.org/issues/40230692)
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to