Question: why do i get an unaligned array as soon as g++ (4.1.0 20050327, cygwin) finds out that it's static (i mean even if i try to fool it around a bit)?
I would guess a limitation of cygwin binutils support, or perhaps of Windows itself.
This seems to work fine on linux. If I compile a simple example using __alignof__, I see that the compiler is assuming 16-byte alignment. If I compile with -S, I see that the compiler is giving them 32-byte alignment (probably for better cache alignment). If I run objdump -x on the a.out file, I see that .bss section has 2**5 (32-byte) alignment. All is as it should be.
We can't give a section more alignment than that supported by the OS, so if Windows only gives the bss and/or data sections 8 byte alignment, then variables in these sections can never have more than 8 byte alignment.
A real bug report, as per
http://gcc.gnu.org/bugs.html
would be useful here, so we can check. In particular, a testcase to reproduce the problem, and exactly what you believe is wrong with the output.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com