[llvm-bugs] [Bug 41027] New: Inline asm validation doesn't use delayed warnings

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Mar 10 13:42:45 PDT 2019


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

            Bug ID: 41027
           Summary: Inline asm validation doesn't use delayed warnings
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: joerg at NetBSD.org
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

Consider the following test case:

static inline void outl(unsigned port, unsigned data) {
  if (__builtin_constant_p(port) && port < 0x100) {
    __asm volatile("outl %0,%w1" : : "a"(data), "n"(port));
  } else {
    __asm volatile("outl %0,%w1" : : "a"(data), "d"(port));
  }
}

void f(unsigned port) { outl(1, 1); }

This kind of assembler construct has been used for ages on various
architectures, especially if there are instruction forms that require
hard-coded immediates. Variants with __always_inline__ apply as well. This got
broken by the recent validation for 'n' as it doesn't use the dead code warning
elimination support.

-- 
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/20190310/89d7fcd3/attachment.html>


More information about the llvm-bugs mailing list