Fix bad regression from r263077 when building with MSVC.
authorNico Weber <nicolasweber@gmx.de>
Sat, 12 Mar 2016 01:57:31 +0000 (01:57 +0000)
committerNico Weber <nicolasweber@gmx.de>
Sat, 12 Mar 2016 01:57:31 +0000 (01:57 +0000)
That change did:

  -#if defined(__BIG_ENDIAN__)
  +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__

If __BYTE_ORDER__ and __ORDER_BIG_ENDIAN__ aren't defined, like
they are with MSVC, this condition is true (0 == 0).

Fixes PR26919.

llvm-svn: 263324

compiler-rt/lib/ubsan/ubsan_value.cc
compiler-rt/test/ubsan/TestCases/Float/cast-overflow.cpp

index 72faf2e..466834c 100644 (file)
@@ -83,12 +83,12 @@ FloatMax Value::getFloatValue() const {
 #endif
       case 32: {
         float Value;
-#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
        // For big endian the float value is in the last 4 bytes.
        // On some targets we may only have 4 bytes so we count backwards from
        // the end of Val to account for both the 32-bit and 64-bit cases.
        internal_memcpy(&Value, ((const char*)(&Val + 1)) - 4, 4);
-#else 
+#else
        internal_memcpy(&Value, &Val, 4);
 #endif
         return Value;
index e833d9f..5f51553 100644 (file)
@@ -11,9 +11,6 @@
 // FIXME: not %run %t 8 2>&1 | FileCheck %s --check-prefix=CHECK-8
 // RUN: not %run %t 9 2>&1 | FileCheck %s --check-prefix=CHECK-9
 
-// FIXME: http://llvm.org/PR26919
-// XFAIL: win32
-
 // This test assumes float and double are IEEE-754 single- and double-precision.
 
 #if defined(__APPLE__)