[PATCH] D11448: [UBSan][MIPS] Fix cast-overflow tests for mips big endian.

Richard Smith via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 10 11:37:57 PDT 2015


rsmith added inline comments.

================
Comment at: lib/ubsan/ubsan_value.cc:86
@@ -85,3 +85,3 @@
         float Value;
-#if defined(__BIG_ENDIAN__)
+#if defined(__BIG_ENDIAN__) && !defined(__mips__)
        // For big endian the float value is in the second 4 bytes
----------------
This fix is incorrect, as is the original code. The problem is that the code is assuming that all big-endian targets have a 64-bit uptr type. The right fix would be to revert this change and change the big-endian code to something like:

    internal_memcpy(&Value, (const char*)(&Val + 1) - 4, 4);

(That is, on BE systems, the value is in the last four bytes of Val, not the first four, no matter how wide or narrow the uptr type actually is.)


Repository:
  rL LLVM

http://reviews.llvm.org/D11448





More information about the llvm-commits mailing list