https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53929

--- Comment #17 from LIU Hao <lh_mouse at 126 dot com> ---
Yeah. It looks to me like the Microsoft compiler doesn't actually uses the
assembler (like LLVM).

Given the C source:
```
extern int rax;
int main() { return rax; }
```

which compiled without errors:
```
> cl /O2 /c test.c /Fatest.asm
Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30148 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

test.c
```

and produced this assembly file
```
include listing.inc

INCLUDELIB LIBCMT
INCLUDELIB OLDNAMES

PUBLIC  main
EXTRN   rax:DWORD
_TEXT   SEGMENT
main    PROC                                            ; COMDAT
        mov     eax, DWORD PTR rax
        ret     0
main    ENDP
_TEXT   ENDS
END
```

which can't be assembled
```
> ml64 /c test.asm
Microsoft (R) Macro Assembler (x64) Version 14.29.30148.0
Copyright (C) Microsoft Corporation.  All rights reserved.

 Assembling: test.asm
test.asm(9) : error A2008:syntax error : rax
test.asm(16) : error A2032:invalid use of register
```

Reply via email to