https://bugs.llvm.org/show_bug.cgi?id=45435

            Bug ID: 45435
           Summary: Compilation error when using -save-temps -masm=intel
           Product: clang
           Version: 10.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangb...@nondot.org
          Reporter: peterwarrenfr...@gmail.com
                CC: llvm-bugs@lists.llvm.org, neeil...@live.com,
                    richard-l...@metafoo.co.uk

Created attachment 23311
  --> https://bugs.llvm.org/attachment.cgi?id=23311&action=edit
A zip file containing the original C code, cut-down preprocessed version, and
generated assembly.

Hi,

When compiling C with the clang frontend using -save-temps -masm=intel it seems
to think the following x86 assembly it generates is invalid when it comes to
assembling it.


$ clang -save-temps -masm=intel -c -o hello_world.o hello_world.i

hello_world.s:18:16: error: invalid base+index expression
        mov     qword ptr [ST], rax


$ clang -save-temps -masm=att -c -o hello_world.o hello_world.i

** no errors, compiles fine**

$ clang -masm=intel -c -o hello_world.o hello_world.i

** no errors, compiles fine**


ST is a file-level declared pointer to a typedef struct, although if I change
ST to be declared within the scope of the function I do not get a compilation
error because clang just puts it in the stack instead of trying to reference a
symbol called ST.

The hello_world.i file is the preprocessed version of the original file
(hello_world.c), that I've trimmed down to be as small as possible to
demonstrate the bug.

I've tried this with clang 9.0 and 10.0 and both seem to show the same error.
If you want more context on this code I found this while working on this
project
https://github.com/badcf00d/bare-bones-uefi/tree/clang-save-temps-intel-bug.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to