[llvm-bugs] [Bug 37860] New: Inline asm fails to notify on bad inline asm eventually crashing
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Jun 19 15:45:42 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=37860
Bug ID: 37860
Summary: Inline asm fails to notify on bad inline asm
eventually crashing
Product: clang
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: echristo at gmail.com
CC: llvm-bugs at lists.llvm.org
Found via a crash on invalid, there was an inline asm that looked like:
__attribute__((target("avx,avx2,fma"))) void Accumulate(__m256 a, __m256 b,
__m256 *acc) {
asm("vfmadd132ps %0 %1 (%2)" : : "r"(a), "r"(b), "r"(acc) :);
}
The somewhat more correct version would look like:
__attribute__((target("avx,avx2,fma"))) void Accumulate(__m256 a, __m256 b,
__m256 *acc) {
asm("vfmadd132ps %0,%1,%2" : "+x"(a) : "x"(b), "x"(*acc) :);
}
Filing this bug to get better diagnostics and so I don't forget it.
The register constraints are wrong and we should have identified them,
unfortunately the code that looks at that isn't looking at the attributes on
the target to make those determinations and so wouldn't identify either them or
what's going on in a number of places.
The inline asm checker would have failed even on the correct code because it's
using the -msse4.2 command line to do the verification thus thinking that the
'x' constraint corresponds to 128 bits rather than 256 bits.
This means that we need subtarget/verification checking here for target
attribute code in addition to the code that verifies for intrinsics so we don't
incorrectly warn/error on valid code.
--
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/20180619/980f8fc0/attachment.html>
More information about the llvm-bugs
mailing list