This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
uint64_t alignof odditity on x86
- From: Jan Engelhardt <jengelh at medozas dot de>
- To: gcc at gcc dot gnu dot org
- Date: Tue, 16 Jun 2009 08:17:19 +0200 (CEST)
- Subject: uint64_t alignof odditity on x86
Hi,
I noticed that __alignof__(uint64_t) will return 8, while
__alignof__(struct { uint64_t x; }) will give only 4. This
run on a typical 32-bit x86 CPU (GCC config below).
What I am wondering about is why GCC was coded to give different
alignments here. If aligning a single uint64_t to a boundary of 8 for
whatever reason there may be (performance?), not doing so when it is
inside a struct appears to be a discrepancy.
---
Using built-in specs.
Target: i586-suse-linux
Configured with: ../configure --prefix=/usr --infodir=/usr/share/info
--mandir=/usr/share/man --libdir=/usr/lib --libexecdir=/usr/lib
--enable-languages=c,c++,objc,fortran,obj-c++,java,ada
--enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.3
--enable-ssp --disable-libssp --with-bugurl=http://bugs.opensuse.org/
--with-pkgversion='SUSE Linux' --disable-libgcj --disable-libmudflap
--with-slibdir=/lib --with-system-zlib --enable-__cxa_atexit
--enable-libstdcxx-allocator=new --disable-libstdcxx-pch
--enable-version-specific-runtime-libs --program-suffix=-4.3
--enable-linux-futex --without-system-libunwind --with-cpu=generic
--build=i586-suse-linux
Thread model: posix
gcc version 4.3.2 [gcc-4_3-branch revision 141291] (SUSE Linux)
openSUSE 11.1 i586.