[compiler-rt] r219559 - [UBSan] Fix UBSan testcase for float->int conversion after LLVM r219542.

Alexey Samsonov vonosmas at gmail.com
Fri Oct 10 18:34:16 PDT 2014


Author: samsonov
Date: Fri Oct 10 20:34:16 2014
New Revision: 219559

URL: http://llvm.org/viewvc/llvm-project?rev=219559&view=rev
Log:
[UBSan] Fix UBSan testcase for float->int conversion after LLVM r219542.

Modified:
    compiler-rt/trunk/test/ubsan/TestCases/Float/cast-overflow.cpp

Modified: compiler-rt/trunk/test/ubsan/TestCases/Float/cast-overflow.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/ubsan/TestCases/Float/cast-overflow.cpp?rev=219559&r1=219558&r2=219559&view=diff
==============================================================================
--- compiler-rt/trunk/test/ubsan/TestCases/Float/cast-overflow.cpp (original)
+++ compiler-rt/trunk/test/ubsan/TestCases/Float/cast-overflow.cpp Fri Oct 10 20:34:16 2014
@@ -84,9 +84,12 @@ int main(int argc, char **argv) {
   case '1':
     // CHECK-1: runtime error: value -2.14748{{.*}} is outside the range of representable values of type 'int'
     return MinFloatRepresentableAsInt - 0x100;
-  case '2':
+  case '2': {
     // CHECK-2: runtime error: value -1 is outside the range of representable values of type 'unsigned int'
-    return (unsigned)-1.0;
+    volatile float f = -1.0;
+    volatile unsigned u = (unsigned)f;
+    return 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);





More information about the llvm-commits mailing list