Iain Sandoe via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
Jakub Jelinek via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
On Thu, Aug 13, 2020 at 02:06:21PM +0200, Tobias Burnus wrote:
Build server is x86_64-gnu-linux, "i686-pc-linux-gnu-g++" is a native
binary of GCC 5.2.0
[Don't ask why i686 and not x86_64 is used.]
Ah, ok, so this boils down to:
int i = alignof (long long int);
struct TTT { char a; long long int b; };
int j = alignof (TTT);
ending up to be 8, 4 with -O2 -m32 in GCC 4.8 - 7.x and
only in GCC 8+ 4, 4.
Also the case for long long (darwin) and double (darwin, aix) where the
embedded alignmen
is 4 and the natural aligment is 8 - as ABI (so in dependent of compiler
version).
(which breaks bootstrap on all 32b Darwin hosts at least)
If the desired outcome is that the embedded vector is aligned to the
natural alignment
of the type that could be forced on that field of the vec?
i.e:
diff --git a/gcc/vec.h b/gcc/vec.h
index db48e97..a8fca34 100644
--- a/gcc/vec.h
+++ b/gcc/vec.h
@@ -623,7 +623,7 @@ public:
/* FIXME - These fields should be private, but we need to cater to
compilers that have stricter notions of PODness for types. */
vec_prefix m_vecpfx;
- T m_vecdata[1];
+ T m_vecdata[1] __attribute__((__aligned__(alignof(T))));
};