diff options
author | Kostya Serebryany <kcc@google.com> | 2014-05-23 14:45:13 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2014-05-23 14:45:13 +0000 |
commit | a72efdff9e29a108eebcce81641e75afbc7e22b9 (patch) | |
tree | 57752ceaedeb19766ed397c7d44a17fab7578e1b /compiler-rt/test/ubsan/TestCases/Float/cast-overflow.cpp | |
parent | d179d939a8ed16b65ef38d6845107cba7ee35bd0 (diff) | |
download | bcm5719-llvm-a72efdff9e29a108eebcce81641e75afbc7e22b9.tar.gz bcm5719-llvm-a72efdff9e29a108eebcce81641e75afbc7e22b9.zip |
[ubsan] handle long double in 32-bit mode; part of the patch by Marek Polacek
llvm-svn: 209516
Diffstat (limited to 'compiler-rt/test/ubsan/TestCases/Float/cast-overflow.cpp')
-rw-r--r-- | compiler-rt/test/ubsan/TestCases/Float/cast-overflow.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/compiler-rt/test/ubsan/TestCases/Float/cast-overflow.cpp b/compiler-rt/test/ubsan/TestCases/Float/cast-overflow.cpp index 801a99f9aea..6f64d1354b7 100644 --- a/compiler-rt/test/ubsan/TestCases/Float/cast-overflow.cpp +++ b/compiler-rt/test/ubsan/TestCases/Float/cast-overflow.cpp @@ -9,6 +9,21 @@ // RUN: %run %t 6 2>&1 | FileCheck %s --check-prefix=CHECK-6 // FIXME: %run %t 7 2>&1 | FileCheck %s --check-prefix=CHECK-7 // RUN: %run %t 8 2>&1 | FileCheck %s --check-prefix=CHECK-8 +// RUN: %run %t 9 2>&1 | FileCheck %s --check-prefix=CHECK-9 + +// FIXME: run all ubsan tests in 32- and 64-bit modes (?). +// RUN: %clangxx -fsanitize=float-cast-overflow -m32 %s -o %t +// RUN: %run %t _ +// RUN: %run %t 0 2>&1 | FileCheck %s --check-prefix=CHECK-0 +// RUN: %run %t 1 2>&1 | FileCheck %s --check-prefix=CHECK-1 +// RUN: %run %t 2 2>&1 | FileCheck %s --check-prefix=CHECK-2 +// RUN: %run %t 3 2>&1 | FileCheck %s --check-prefix=CHECK-3 +// RUN: %run %t 4 2>&1 | FileCheck %s --check-prefix=CHECK-4 +// RUN: %run %t 5 2>&1 | FileCheck %s --check-prefix=CHECK-5 +// RUN: %run %t 6 2>&1 | FileCheck %s --check-prefix=CHECK-6 +// FIXME: %run %t 7 2>&1 | FileCheck %s --check-prefix=CHECK-7 +// RUN: %run %t 8 2>&1 | FileCheck %s --check-prefix=CHECK-8 +// RUN: %run %t 9 2>&1 | FileCheck %s --check-prefix=CHECK-9 // This test assumes float and double are IEEE-754 single- and double-precision. @@ -95,5 +110,10 @@ 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': + volatile long double ld = 300.0; + // CHECK-9: runtime error: value 300 is outside the range of representable values of type 'char' + char c = ld; + return c; } } |