[compiler-rt] r262733 - [ubsan/float-cast-overflow] Make the test also work with C++11 narrowing

Filipe Cabecinhas via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 4 10:33:44 PST 2016


Author: filcab
Date: Fri Mar  4 12:33:44 2016
New Revision: 262733

URL: http://llvm.org/viewvc/llvm-project?rev=262733&view=rev
Log:
[ubsan/float-cast-overflow] Make the test also work with C++11 narrowing

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=262733&r1=262732&r2=262733&view=diff
==============================================================================
--- compiler-rt/trunk/test/ubsan/TestCases/Float/cast-overflow.cpp (original)
+++ compiler-rt/trunk/test/ubsan/TestCases/Float/cast-overflow.cpp Fri Mar  4 12:33:44 2016
@@ -61,18 +61,18 @@ int main(int argc, char **argv) {
 
   // Build a '+Inf'.
 #if BYTE_ORDER == LITTLE_ENDIAN
-  char InfVal[] = { 0x00, 0x00, 0x80, 0x7f };
+  unsigned char InfVal[] = { 0x00, 0x00, 0x80, 0x7f };
 #else
-  char InfVal[] = { 0x7f, 0x80, 0x00, 0x00 };
+  unsigned char InfVal[] = { 0x7f, 0x80, 0x00, 0x00 };
 #endif
   float Inf;
   memcpy(&Inf, InfVal, 4);
 
   // Build a 'NaN'.
 #if BYTE_ORDER == LITTLE_ENDIAN
-  char NaNVal[] = { 0x01, 0x00, 0x80, 0x7f };
+  unsigned char NaNVal[] = { 0x01, 0x00, 0x80, 0x7f };
 #else
-  char NaNVal[] = { 0x7f, 0x80, 0x00, 0x01 };
+  unsigned char NaNVal[] = { 0x7f, 0x80, 0x00, 0x01 };
 #endif
   float NaN;
   memcpy(&NaN, NaNVal, 4);




More information about the llvm-commits mailing list