[llvm-bugs] [Bug 45435] New: Compilation error when using -save-temps -masm=intel

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Apr 5 05:54:17 PDT 2020


            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: unassignedclangbugs at nondot.org
          Reporter: peterwarrenfrost at gmail.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at 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.


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

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200405/6079496d/attachment.html>

More information about the llvm-bugs mailing list