diff options
author | Daniel Sanders <daniel.sanders@imgtec.com> | 2015-08-11 18:40:02 +0000 |
---|---|---|
committer | Daniel Sanders <daniel.sanders@imgtec.com> | 2015-08-11 18:40:02 +0000 |
commit | cf8ba70b76c89dac6da13eae243e40a3734ecedc (patch) | |
tree | 20c848c7236e3e8e934ee193d44b6dcbac787c92 /lib/ubsan | |
parent | 27b6e3cfe24a451ca4f3d3f4eaa36a4574c4d4f4 (diff) |
[ubsan][mips] Revise r243384 to avoid special casing big-endian mips.
Account for the case when uptr is 32-bit instead of trying to fix this case
using the little endian path.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@244646 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ubsan')
-rw-r--r-- | lib/ubsan/ubsan_value.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/ubsan/ubsan_value.cc b/lib/ubsan/ubsan_value.cc index 4ae385fae..79dc4c8e8 100644 --- a/lib/ubsan/ubsan_value.cc +++ b/lib/ubsan/ubsan_value.cc @@ -83,10 +83,11 @@ FloatMax Value::getFloatValue() const { #endif case 32: { float Value; -#if defined(__BIG_ENDIAN__) && !defined(__mips__) - // For big endian the float value is in the second 4 bytes - // instead of the first 4 bytes. - internal_memcpy(&Value, ((const char*)&Val)+4, 4); +#if defined(__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 internal_memcpy(&Value, &Val, 4); #endif |