aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/ADT/SmallVector.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/llvm/ADT/SmallVector.h b/include/llvm/ADT/SmallVector.h
index e3aec7fec0..d0e898d68b 100644
--- a/include/llvm/ADT/SmallVector.h
+++ b/include/llvm/ADT/SmallVector.h
@@ -33,12 +33,17 @@ class SmallVectorImpl {
// aligned sufficiently. Instead, we either use GCC extensions, or some
// number of union instances for the space, which guarantee maximal alignment.
protected:
+#ifdef __GNUC__
+ typedef char U;
+ U FirstEl __attribute__((aligned(__alignof__(double))));
+#else
union U {
double D;
long double LD;
long long L;
void *P;
} FirstEl;
+#endif
// Space after 'FirstEl' is clobbered, do not add any instance vars after it.
public:
// Default ctor - Initialize to empty.