]> granicus.if.org Git - llvm/commitdiff
[WebAssembly] Fix parseImmediate's memory alignment requirement
authorHeejin Ahn <aheejin@gmail.com>
Fri, 8 Feb 2019 04:06:56 +0000 (04:06 +0000)
committerHeejin Ahn <aheejin@gmail.com>
Fri, 8 Feb 2019 04:06:56 +0000 (04:06 +0000)
This fixes the current failure in the x86-64 ubsan bot caused by
r353496.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353499 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp

index 287b2443ddbdd2b8346a03f3d9a460d515b11009..23cf60c1877c9b4d84e1dcc4b1c745ecf415ee5e 100644 (file)
@@ -108,7 +108,7 @@ template <typename T>
 bool parseImmediate(MCInst &MI, uint64_t &Size, ArrayRef<uint8_t> Bytes) {
   if (Size + sizeof(T) > Bytes.size())
     return false;
-  T Val = support::endian::read<T, support::endianness::little, alignof(T)>(
+  T Val = support::endian::read<T, support::endianness::little, 1>(
       Bytes.data() + Size);
   Size += sizeof(T);
   if (std::is_floating_point<T>::value) {