[LLVMbugs] [Bug 3582] New: fp inline asm assertion failure

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Fri Feb 13 18:37:50 PST 2009


http://llvm.org/bugs/show_bug.cgi?id=3582

           Summary: fp inline asm assertion failure
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Backend: X86
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: nlewycky at google.com
                CC: rafael.espindola at gmail.com, llvmbugs at cs.uiuc.edu


Created an attachment (id=2559)
 --> (http://llvm.org/bugs/attachment.cgi?id=2559)
testcase

This delta-reduced testcase:

  static int FastIntRound (double x)
  {
    int result;
    __asm__ __volatile__ ("fistpl %0":"=m" (result):"t" (x):"st");
  }
  void foo() {
    FastIntRound(1e6);
    FastIntRound(1e6);
  }

compiles to the attached bitcode file on a 32-bit x86 linux machine, and emits
this ugly assertion failure at codegen time:

$ llc x.bc -f
llc: X86FloatingPoint.cpp:995:
void<unnamed>::FPS::handleSpecialFP(llvm::ilist_iterator<llvm::MachineInstr>&):
Assertion `(StackTop == 1 || StackTop == 2) && "Stack should have one or two
element on it to return!"' failed.
(gdb) bt
#0  0x00007fc3af63c095 in raise () from /lib/libc.so.6
#1  0x00007fc3af63daf0 in abort () from /lib/libc.so.6
#2  0x00007fc3af6352df in __assert_fail () from /lib/libc.so.6
#3  0x0000000000b16cdd in handleSpecialFP (this=0x17a98a0, I=@0x7fffb87417b0)
    at X86FloatingPoint.cpp:994
#4  0x0000000000b17c44 in processBasicBlock (this=0x17a98a0, MF=@0x17b3b50, 
    BB=@0x17b4150) at X86FloatingPoint.cpp:257
#5  0x0000000000b180a9 in runOnMachineFunction (this=0x17a98a0, MF=@0x17b3b50)
    at X86FloatingPoint.cpp:211
#6  0x00000000008763d5 in llvm::MachineFunctionPass::runOnFunction (
    this=0x17a98a0, F=@0x177d170)
    at
/usr/local/google/home/nlewycky/llvm/include/llvm/CodeGen/MachineFunctionPass.h:42
#7  0x0000000001086eb3 in llvm::FPPassManager::runOnFunction (this=0x177ffe0, 
    F=@0x177d170) at PassManager.cpp:1323
#8  0x0000000001087432 in llvm::FunctionPassManagerImpl::run (this=0x177f9f0, 
    F=@0x177d170) at PassManager.cpp:1281
#9  0x000000000108759c in llvm::FunctionPassManager::run (this=0x7fffb8741a70, 
    F=@0x177d170) at PassManager.cpp:1226
#10 0x00000000008104eb in main (argc=3, argv=0x7fffb8741c88) at llc.cpp:317
(gdb) up 3
#3  0x0000000000b16cdd in handleSpecialFP (this=0x17a98a0, I=@0x7fffb87417b0)
    at X86FloatingPoint.cpp:994
994         assert((StackTop == 1 || StackTop == 2)
(gdb) p StackTop
$1 = 0
(gdb) up
#4  0x0000000000b17c44 in processBasicBlock (this=0x17a98a0, MF=@0x17b3b50, 
    BB=@0x17b4150) at X86FloatingPoint.cpp:257
257         case X86II::SpecialFP:  handleSpecialFP(I); break;
(gdb) p (*I).dump()
  FpSET_ST0_80 %FP0<kill>, %ST0<imp-def>
$2 = void
(gdb)


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list