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

            Bug ID: 49167
           Summary: Clang accept invalid inline asm
           Product: clang
           Version: 11.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]

Hi,

I got an invalid program:

---
int a;
int main() { asm("" : "=a"(a), "=d"(a) : "d"(.1), "1"(&a)); }
---

I use c-reduce to get the minimal test-case. It is an invalid code. But clang
version 11.1.0 accepts it by accident (my apt-installed 6.0.0 also accepts it).

Note that above code is rejected by GCC (I tested from 6.0 to 10.0) no matter
what optimization level is used. Specifically, GCC blames that ‘asm’ operand
has impossible constraints.

I guess clang should have checked it. Otherwise it may generate code with
unpredictable behaviors, when compiling the bogus code with other complex code.

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

Reply via email to