[llvm-bugs] [Bug 42641] New: Floating point asm constraint for arm target without floating point should give error

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jul 16 10:14:05 PDT 2019


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

            Bug ID: 42641
           Summary: Floating point asm constraint for arm target without
                    floating point should give error
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: john.brawn at arm.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

If you have some inline asm that has a constraint that specifies a
floating-point register, e.g.

  float func(float t)
  {
    __asm__ ( "" : "=w" (t) );
    return t;
  }

then compiling for an arm cpu without floating point (e.g. --target=arm
-mcpu=cortex-m3) using a build of clang with asserts enabled you get

  llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp:65: bool
llvm::DAGTypeLegalizer::SoftenFloatResult(llvm::SDNode*, unsigned int):
Assertion `isLegalInHWReg(N->getValueType(ResNo)) && "Unsupported
SoftenFloatRes opcode!"' failed.

or with a build without asserts you end up in an endless loop in SelectionDAG.

We should be rejecting this code early and giving an error. It looks like
ARMTargetInfo::validateAsmConstraint is probably the place to do this.

-- 
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/20190716/537b9da5/attachment.html>


More information about the llvm-bugs mailing list