[llvm-bugs] [Bug 45918] New: Local register variables using high-byte registers should cause a -Wgcc-compat warning

via llvm-bugs llvm-bugs at lists.llvm.org
Wed May 13 19:30:03 PDT 2020


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

            Bug ID: 45918
           Summary: Local register variables using high-byte registers
                    should cause a -Wgcc-compat warning
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: josephcsible at gmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

Consider this C function:

char f(void) {
    register char x __asm__("dh");
    __asm__("movb $42, %%dh" : "=r"(x));
    return x;
}

When compiled with Clang, it will return 42, as expected. However, GCC doesn't
distinguish between "dh" and "dl", so it returns whatever happened to be in %dl
instead. They don't consider this a bug
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95121) so likely won't be
changing it anytime soon. As such, we should emit a -Wgcc-compat warning for
local register variables using high-byte registers.

-- 
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/20200514/61c3f098/attachment-0001.html>


More information about the llvm-bugs mailing list