mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 11:02:59 +02:00
Fix PR409:
Implement the suggested check to ensure that out-of-range float constants don't get accepted by LLVM accidentally. Adjust the supporting test cases as well. llvm-svn: 24963
This commit is contained in:
parent
d752db6276
commit
56825ced86
@ -482,6 +482,9 @@ bool ConstantFP::isValueValidForType(const Type *Ty, double Val) {
|
||||
|
||||
// TODO: Figure out how to test if a double can be cast to a float!
|
||||
case Type::FloatTyID:
|
||||
float FV = float(Val);
|
||||
double DV = double(FV);
|
||||
return IsNAN(Val) || Val == DV;
|
||||
case Type::DoubleTyID:
|
||||
return true; // This is the largest type...
|
||||
}
|
||||
|
@ -1,5 +0,0 @@
|
||||
; RUN: llvm-as < %s -o /dev/null -f
|
||||
|
||||
; make sure that 'float' values have their value properly truncated.
|
||||
|
||||
global float 0x1
|
@ -1,5 +1,4 @@
|
||||
; RUN: llvm-as %s -o /dev/null 2>&1 | grep "constant invalid for type"
|
||||
; XFAIL: *
|
||||
|
||||
;; This is a testcase for PR409
|
||||
|
||||
|
@ -0,0 +1,6 @@
|
||||
; RUN: llvm-as < %s -o /dev/null -f
|
||||
; XFAIL: *
|
||||
|
||||
; make sure that invalid 'float' values are caught.
|
||||
|
||||
global float 0x1
|
Loading…
Reference in New Issue
Block a user