[libcxxabi] r336312 - [demangler] Avoid alignment warning

Serge Pavlov via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 4 23:24:29 PDT 2018

Author: sepavloff
Date: Wed Jul  4 23:24:29 2018
New Revision: 336312

URL: http://llvm.org/viewvc/llvm-project?rev=336312&view=rev
[demangler] Avoid alignment warning

The alignment specified by a constant for the field
`BumpPointerAllocator::InitialBuffer` exceeded the alignment
guaranteed by `malloc` and `new` on Windows. This change set
the alignment value to that of `long double`, which is defined
by the used platform.

It fixes https://bugs.llvm.org/show_bug.cgi?id=37944.

Differential Revision: https://reviews.llvm.org/D48889


Modified: libcxxabi/trunk/src/cxa_demangle.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_demangle.cpp?rev=336312&r1=336311&r2=336312&view=diff
--- libcxxabi/trunk/src/cxa_demangle.cpp (original)
+++ libcxxabi/trunk/src/cxa_demangle.cpp Wed Jul  4 23:24:29 2018
@@ -1890,7 +1890,7 @@ class BumpPointerAllocator {
   static constexpr size_t AllocSize = 4096;
   static constexpr size_t UsableAllocSize = AllocSize - sizeof(BlockMeta);
-  alignas(16) char InitialBuffer[AllocSize];
+  alignas(long double) char InitialBuffer[AllocSize];
   BlockMeta* BlockList = nullptr;
   void grow() {

More information about the cfe-commits mailing list