PSARC/2013/188 Clang/LLVM
15777690 clang/llvm compiler infrastructure in Solaris
21851513 severe memory corruption in the LLVM command-line parsing module
22031298 toxic bugs in LLVM ilist/plist end up eliminating entire MachineBasicBlocks
22065707 LLVM SPARC assembler generator emits wrong ELF Section flags
22346218 LLVM's assembler printer on SPARC needs a lot of work
21870061 partial template specializations in CommandLine.h are buggy
21874261 the Google Test Harness doesn't know how to count threads in Solaris
21697459 memory corruption in LLVM IR Code Generator
21341968 llc on SPARC should not need to be passed -march=sparc or -march=sparcv9
21870103 TableGen makes incorrect assumptions about anonymous namespace instantiation
21870087 naming convention for the InputFile key is inconsistent across LLVM utilities
21870099 128 bytes for a filesystem path is definitely not enough
21870067 lli makes incorrect assumptions about anonymous namespace instantiation order
21870065 llc makes incorrect assumptions about anonymous namespace instantiation order
21870283 llvm::sys::Process::GetArgumentVector should overload for std::vector
21874221 clang C++ does not properly initialize the C++ Standard Library's iostreams
# https://llvm.org/bugs/show_bug.cgi?id=24615
--- tools/clang/lib/Sema/TypeLocBuilder.h 2014-08-13 09:25:19.000000000 -0700
+++ tools/clang/lib/Sema/TypeLocBuilder.h 2015-08-28 16:45:41.733661825 -0700
@@ -39,7 +39,7 @@
#endif
/// The inline buffer.
- enum { BufferMaxAlignment = llvm::AlignOf<void*>::Alignment };
+ enum { BufferMaxAlignment = llvm::AlignOf<uint64_t>::Alignment };
llvm::AlignedCharArray<BufferMaxAlignment, InlineCapacity> InlineBuffer;
unsigned NumBytesAtAlign4, NumBytesAtAlign8;
@@ -52,7 +52,7 @@
~TypeLocBuilder() {
if (Buffer != InlineBuffer.buffer)
- delete[] Buffer;
+ std::free(Buffer);
}
/// Ensures that this buffer has at least as much capacity as described.
--- tools/clang/lib/Sema/TypeLocBuilder.cpp 2014-05-25 23:22:03.000000000 -0700
+++ tools/clang/lib/Sema/TypeLocBuilder.cpp 2015-08-25 18:53:43.000000000 -0700
@@ -13,6 +13,8 @@
//===----------------------------------------------------------------------===//
#include "TypeLocBuilder.h"
+#include <cstring>
+#include <stdlib.h>
using namespace clang;
@@ -46,14 +48,36 @@
assert(NewCapacity > Capacity);
// Allocate the new buffer and copy the old data into it.
- char *NewBuffer = new char[NewCapacity];
+ char *NewBuffer;
+
+#if defined(_MSC_VER)
+ NewBuffer = _aligned_malloc(NewCapacity, (size_t) BufferMaxAlignment);
+ assert(NewBuffer && "_aligned_malloc failed!");
+ if (!NewBuffer) {
+ llvm::errs() << __PRETTY_FUNCTION__ << ": _aligned_malloc failed!\n";
+ abort();
+ }
+#else
+ int R = posix_memalign((void**) &NewBuffer,
+ (size_t) BufferMaxAlignment, NewCapacity);
+ assert((R == 0) && "posix_memalign failed!");
+ assert(NewBuffer && "posix_memalign failed!");
+ if ((R != 0) || (!NewBuffer)) {
+ llvm::errs() << __PRETTY_FUNCTION__ << ": posix_memalign failed!\n";
+ abort();
+ }
+#endif
+
+ (void) std::memset(NewBuffer, 0, NewCapacity);
+
unsigned NewIndex = Index + NewCapacity - Capacity;
- memcpy(&NewBuffer[NewIndex],
+ (void) std::memcpy(&NewBuffer[NewIndex],
&Buffer[Index],
Capacity - Index);
- if (Buffer != InlineBuffer.buffer)
- delete[] Buffer;
+ if (Buffer != InlineBuffer.buffer) {
+ std::free(Buffer);
+ }
Buffer = NewBuffer;
Capacity = NewCapacity;