Fix PR897
authorChris Lattner <sabre@nondot.org>
Sun, 8 Oct 2006 22:28:34 +0000 (22:28 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 8 Oct 2006 22:28:34 +0000 (22:28 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30820 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/SmallVector.h

index e3aec7fec050c42f1dddc97c62aaafb2f248de93..d0e898d68bbeeac0c4e1151c7876639bfa4d0072 100644 (file)
@@ -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.