[llvm-bugs] [Bug 35208] New: Hosts.cpp: calls xgetbv before detecting xsave support

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Nov 5 06:43:24 PST 2017


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

            Bug ID: 35208
           Summary: Hosts.cpp: calls xgetbv before detecting xsave support
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Support Libraries
          Assignee: unassignedbugs at nondot.org
          Reporter: gonzalobg88 at gmail.com
                CC: llvm-bugs at lists.llvm.org

In Hosts.cpp, the following code:

   bool HasAVXSave = ((ECX >> 27) & 1) && ((ECX >> 28) & 1) &&
                      !getX86XCR0(&EAX, &EDX) && ((EAX & 0x6) == 0x6);

indirectly calls xgetbv through getX86XCR0 without checking whether the CPU
supports XSAVE before doing so. XSAVE is detected a bit after in: 

    // Only enable XSAVE if OS has enabled support for saving YMM state.
    Features["xsave"] = HasAVXSave && (ECX >> 26) & 1;

-- 
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/20171105/19ee3220/attachment.html>


More information about the llvm-bugs mailing list