This relates to bug 13167
(http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13617)
It looks like the compiler is generating appropriate code but gas
isn't doing the right thing with it, at least not consistently.
With this test program, compiled with GCC 4.1.2 mipsel-netbsdelf:
int i = 3;
char foo[17] __attribute__ ((aligned(32)));
I get .bss aligned 2**4.
If I change the second line:
int i = 3;
static char foo[17] __attribute__ ((aligned(32)));
I get .bss aligned 2**5, which is what it should be.
The assembly files are basically the same; the only difference is a
".local foo":
.file 1 "test.c"
.section .mdebug.abi32
.previous
.abicalls
.globl i
.data
.align 2
.type i, @object
.size i, 4
i:
.word 3
.local foo
.comm foo,17,32
.ident "GCC: (GNU) 4.1.2"
Should this be a binutils bug report, or can/should GCC work around
this? As it stands, this is a "wrong code" bug, variables end up not
being aligned as requested.
paul