[llvm-bugs] [Bug 44328] New: clang and gcc disagree on output constraint

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Dec 17 15:31:03 PST 2019


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

            Bug ID: 44328
           Summary: clang and gcc disagree on output constraint
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: ndesaulniers at google.com
                CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
                    llvm-dev at redking.me.uk, spatel+llvm at rotateright.com

Consider the following code:

void baz(void) {
    register int y asm("rdx") = 0;
    asm volatile ("mov 42, %0" : "=c"(y));
}

at -O2, GCC produces:

baz():
        mov 42, %ecx
        ret

while Clang produces

baz():                                # @baz()
        movl    42, %edx
        retq

It's not clear to me that the input is even well formed, and I haven't found
code that relies on it yet (knock on wood), but it might be nice to match or
better yet error or warn the user that their code isn't really semantically
correct.

-- 
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/20191217/47a06b9d/attachment.html>


More information about the llvm-bugs mailing list