diff options
| author | Dale Johannesen <dalej@apple.com> | 2009-04-24 21:34:13 +0000 |
|---|---|---|
| committer | Dale Johannesen <dalej@apple.com> | 2009-04-24 21:34:13 +0000 |
| commit | 56cb14c8741f39124ec3cd523391597f950f517f (patch) | |
| tree | e4ce9116a0b6dba92a27aaad655d46b6fe2bc6ec /llvm/lib | |
| parent | c78d34699fc47e947939d640b5ba215f9018b4fc (diff) | |
| download | bcm5719-llvm-56cb14c8741f39124ec3cd523391597f950f517f.tar.gz bcm5719-llvm-56cb14c8741f39124ec3cd523391597f950f517f.zip | |
Fix PR 4057, a crash doing float->char const folding.
This particular one is undefined behavior (although this
isn't related to the crash), so it will no longer do it
at compile time, which seems better.
llvm-svn: 69990
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index edd985ed1ad..954b84233bb 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -2197,16 +2197,17 @@ SDValue SelectionDAG::getNode(unsigned Opcode, DebugLoc DL, } case ISD::FP_TO_SINT: case ISD::FP_TO_UINT: { - integerPart x; + integerPart x[2]; bool ignored; assert(integerPartWidth >= 64); // FIXME need to be more flexible about rounding mode. - APFloat::opStatus s = V.convertToInteger(&x, 64U, + APFloat::opStatus s = V.convertToInteger(x, VT.getSizeInBits(), Opcode==ISD::FP_TO_SINT, APFloat::rmTowardZero, &ignored); if (s==APFloat::opInvalidOp) // inexact is OK, in fact usual break; - return getConstant(x, VT); + APInt api(VT.getSizeInBits(), 2, x); + return getConstant(api, VT); } case ISD::BIT_CONVERT: if (VT == MVT::i32 && C->getValueType(0) == MVT::f32) |

