http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46859
Summary: Attribute depends on location Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: hjl.to...@gmail.com foo2 in this test isn't aligned: [...@gnu-6 pages-1]$ cat a.c __attribute__((aligned(4096))) int * foo1 () { return 0; } int * __attribute__((aligned(4096))) foo2 () { return 0; } __attribute__((aligned(4096))) int foo3 () { return 0; } int __attribute__((aligned(4096))) foo4 () { return 0; } [...@gnu-6 pages-1]$ gcc -S -O2 a.c [...@gnu-6 pages-1]$ cat a.s .file "a.c" .text .align 4096 .globl foo1 .type foo1, @function foo1: .LFB0: .cfi_startproc xorl %eax, %eax ret .cfi_endproc .LFE0: .size foo1, .-foo1 .p2align 4,,15 .globl foo2 .type foo2, @function foo2: .LFB1: .cfi_startproc xorl %eax, %eax ret .cfi_endproc .LFE1: .size foo2, .-foo2 .align 4096 .globl foo3 .type foo3, @function foo3: .LFB2: .cfi_startproc xorl %eax, %eax ret .cfi_endproc .LFE2: .size foo3, .-foo3 .align 4096 .globl foo4 .type foo4, @function foo4: .LFB3: .cfi_startproc xorl %eax, %eax ret .cfi_endproc .LFE3: .size foo4, .-foo4