[LLVMbugs] [Bug 4057] New: Assertion in SelectionDAG.cpp when casting float to char

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Fri Apr 24 10:43:03 PDT 2009


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

           Summary: Assertion in SelectionDAG.cpp when casting float to char
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Common Code Generator Code
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: micah.villmow at amd.com
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=2867)
 --> (http://llvm.org/bugs/attachment.cgi?id=2867)
bitcode of test case

The following test case asserts in SelectionDAG.cpp:getConstant:869 because the
value type being passed in is i8.

The test case is:
void test_cast_float_to_char(char* result)
{
        float test = (float)(47.8363037109375 * 100);
        *result = (char)(test);
}


This fails both x86 and my custom backend.

Get constant is called from selectionDag:2283
case ISD::FP_TO_UINT: {
        integerPart x;
        bool ignored;
        assert(integerPartWidth >= 64);
        // FIXME need to be more flexible about rounding mode.
        APFloat::opStatus s = V.convertToInteger(&x, 64U,
                              Opcode==ISD::FP_TO_SINT,
                              APFloat::rmTowardZero, &ignored);
        if (s==APFloat::opInvalidOp)     // inexact is OK, in fact usual
          break;
        return getConstant(x, VT);
      } 



        llc.exe!_NMSG_WRITE(int rterrnum=10)  Line 198  C
        llc.exe!abort()  Line 59 + 0x7 bytes    C
        llc.exe!_wassert(const wchar_t * expr=0x017ec4c8, const wchar_t *
filename=0x017eb8d8, unsigned int lineno=871)  Line 163       C
        llc.exe!llvm::SelectionDAG::getConstant(unsigned __int64 Val=4783,
llvm::MVT VT={...}, bool isT=false)  Line 871 + 0x69 bytes   C++
>	llc.exe!llvm::SelectionDAG::getNode(unsigned int Opcode=110, llvm::DebugLoc DL={...}, llvm::MVT VT={...}, llvm::SDValue Operand={...})  Line 2293 + 0x20 bytes	C++
        llc.exe!`anonymous
namespace'::DAGCombiner::visitFP_TO_SINT(llvm::SDNode * N=0x03a584f0)  Line
4231 + 0x2e bytes        C++
        llc.exe!`anonymous namespace'::DAGCombiner::visit(llvm::SDNode *
N=0x03a584f0)  Line 760 + 0x10 bytes   C++
        llc.exe!`anonymous namespace'::DAGCombiner::combine(llvm::SDNode *
N=0x03a584f0)  Line 784      C++
        llc.exe!`anonymous namespace'::DAGCombiner::Run(llvm::CombineLevel
AtLevel=Unrestricted)  Line 657      C++
        llc.exe!llvm::SelectionDAG::Combine(llvm::CombineLevel
Level=Unrestricted, llvm::AliasAnalysis & AA={...}, bool Fast=false)  Line 6119
+ 0x40 bytes     C++
        llc.exe!llvm::SelectionDAGISel::CodeGenAndEmitDAG()  Line 581   C++
        llc.exe!llvm::SelectionDAGISel::SelectBasicBlock(llvm::BasicBlock *
LLVMBB=0x029ada10, llvm::ilist_iterator<llvm::Instruction> Begin={...},
llvm::ilist_iterator<llvm::Instruction> End={...})  Line 499        C++
        llc.exe!llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function &
Fn={...}, llvm::MachineFunction & MF={...}, llvm::MachineModuleInfo *
MMI=0x03a5ecf0, llvm::DwarfWriter * DW=0x03a5bde0, const llvm::TargetInstrInfo
& TII={...})  Line 856       C++
        llc.exe!llvm::SelectionDAGISel::runOnFunction(llvm::Function &
Fn={...})  Line 332      C++
        llc.exe!llvm::FPPassManager::runOnFunction(llvm::Function & F={...}) 
Line 1323 + 0x17 bytes    C++
        llc.exe!llvm::FunctionPassManagerImpl::run(llvm::Function & F={...}) 
Line 1281 + 0x10 bytes    C++
        llc.exe!llvm::FunctionPassManager::run(llvm::Function & F={...})  Line
1226 + 0xf bytes C++
        llc.exe!main(int argc=4, char * * argv=0x029a22f0)  Line 319    C++
        llc.exe!__tmainCRTStartup()  Line 266 + 0x19 bytes      C
        llc.exe!mainCRTStartup()  Line 182      C


-- 
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