diff options
Diffstat (limited to 'lib/ubsan/lit_tests/Float/cast-overflow.cpp')
-rw-r--r-- | lib/ubsan/lit_tests/Float/cast-overflow.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/ubsan/lit_tests/Float/cast-overflow.cpp b/lib/ubsan/lit_tests/Float/cast-overflow.cpp index 63410dc87140..8d9120d586a1 100644 --- a/lib/ubsan/lit_tests/Float/cast-overflow.cpp +++ b/lib/ubsan/lit_tests/Float/cast-overflow.cpp @@ -9,7 +9,6 @@ // RUN: %t 6 2>&1 | FileCheck %s --check-prefix=CHECK-6 // FIXME: %t 7 2>&1 | FileCheck %s --check-prefix=CHECK-7 // RUN: %t 8 2>&1 | FileCheck %s --check-prefix=CHECK-8 -// RUN: %t 9 2>&1 | FileCheck %s --check-prefix=CHECK-9 // This test assumes float and double are IEEE-754 single- and double-precision. @@ -36,6 +35,9 @@ int main(int argc, char **argv) { (void)(float)FloatMaxAsUInt128; // ok #endif + float NearlyMinusOne = -0.99999; + unsigned Zero = NearlyMinusOne; // ok + // Build a '+Inf'. char InfVal[] = { 0x00, 0x00, 0x80, 0x7f }; float Inf; @@ -46,6 +48,8 @@ int main(int argc, char **argv) { float NaN; memcpy(&NaN, NaNVal, 4); + double DblInf = (double)Inf; // ok + switch (argv[1][0]) { // FIXME: Produce a source location for these checks and test for it here. @@ -59,8 +63,8 @@ int main(int argc, char **argv) { // CHECK-1: runtime error: value -2.14748{{.*}} is outside the range of representable values of type 'int' return MinFloatRepresentableAsInt - 0x100; case '2': - // CHECK-2: runtime error: value -0.001 is outside the range of representable values of type 'unsigned int' - return (unsigned)-0.001; + // CHECK-2: runtime error: value -1 is outside the range of representable values of type 'unsigned int' + return (unsigned)-1.0; case '3': // CHECK-3: runtime error: value 4.2949{{.*}} is outside the range of representable values of type 'unsigned int' return (unsigned)(MaxFloatRepresentableAsUInt + 0x100); @@ -91,8 +95,5 @@ int main(int argc, char **argv) { case '8': // CHECK-8: runtime error: value 1e+39 is outside the range of representable values of type 'float' return (float)1e39; - case '9': - // CHECK-9: runtime error: value {{.*}} is outside the range of representable values of type 'double' - return (double)Inf; } } |