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

Daniel Sanders via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 10 14:08:10 PDT 2015


dsanders 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
----------------
rsmith wrote:
> 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.)
That makes sense to me. I'll sort out a patch but I won't be able to test it until the morning (UK time). My big-endian machine is refusing to respond to anything more than ping and I'm going to have to physically reset it when I get to work tomorrow.

One question though: Given that we only do 32-bit MIPS releases at the moment, is the current patch 'correct enough' for this release?


Repository:
  rL LLVM

http://reviews.llvm.org/D11448





More information about the llvm-commits mailing list