Simple testcase: #include <stdio.h> #pragma pack(4) struct ABC { double a; int b; bool c; }; int main() { ABC A; ABC B; int C; ABC D; printf("A - %p; B - %p; C - %p; D - %p\n", &A, &B, &C, &D); return 0; } compiled with: gcc test.cpp -lstdc++ Variable D is aligned on 4 bytes and should be 8.
gcc -v: Using built-in specs. Target: sparc-sun-solaris2.8 Configured with: ../gcc-4.1.1/configure --prefix=/export/home/builder/gcc-4.1.1 --disable-multilib --enable-languages=c,c++ Thread model: posix gcc version 4.1.1 Problem originally observed on linux - debian 3.1 with x86 and target sparc-sun-solaris2.8, exists also on original sparc host. -- Summary: wrong alignment with pragma pack(4) Product: gcc Version: 4.1.1 Status: UNCONFIRMED Severity: critical Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dsiata at poczta dot onet dot pl GCC build triplet: sparc-sun-solaris2.8 GCC host triplet: sparc-sun-solaris2.8 GCC target triplet: sparc-sun-solaris2.8 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29078